11# This file is part of cloud-init. See LICENSE file for license information.
2+ from typing import Any , Dict
23from unittest import mock
34
45import pytest
56
67from cloudinit import distros , helpers , settings
78from cloudinit .distros import ug_util
89
9- bcfg = {
10+ bcfg : Dict [ str , Any ] = {
1011 "name" : "bob" ,
1112 "plain_text_passwd" : "ubuntu" ,
1213 "home" : "/home/ubuntu" ,
1920
2021class TestUGNormalize :
2122 def _make_distro (self , dtype , def_user = None ):
22- cfg = dict (settings .CFG_BUILTIN )
23+ cfg : Dict [ str , Any ] = dict (settings .CFG_BUILTIN )
2324 cfg ["system_info" ]["distro" ] = dtype
2425 paths = helpers .Paths (cfg ["system_info" ]["paths" ])
2526 distro_cls = distros .fetch (dtype )
@@ -141,7 +142,7 @@ def test_users_simple(self):
141142
142143 def test_users_old_user (self ):
143144 distro = self ._make_distro ("ubuntu" , bcfg )
144- ug_cfg = {"user" : "zetta" , "users" : "default" }
145+ ug_cfg : Dict [ str , Any ] = {"user" : "zetta" , "users" : "default" }
145146 users , _groups = self ._norm (ug_cfg , distro )
146147 assert "bob" not in users # Bob is not the default now, zetta is
147148 assert "zetta" in users
@@ -214,7 +215,7 @@ def test_users_dict_override_default_attribute(self):
214215 # matches the passed config: False
215216 assert users ["bob" ][key ] is False
216217 elif key == "groups" :
217- assert users ["bob" ][key ] == "," .join (val )
218+ assert users ["bob" ][key ] == "," .join (list ( val ) )
218219 elif key != "name" :
219220 assert users ["bob" ][key ] == val
220221
@@ -231,7 +232,7 @@ def test_users_dict_extract(self):
231232 assert "bob" in users
232233 name , config = ug_util .extract_default (users )
233234 assert name == "bob"
234- expected_config = {}
235+ expected_config : Dict [ str , Any ] = {}
235236 def_config = None
236237 try :
237238 def_config = distro .get_default_user ()
0 commit comments