summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros/test_user_data_normalize.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-05-12 16:43:11 -0400
committerScott Moser <smoser@ubuntu.com>2016-05-12 16:43:11 -0400
commit4ba4df2f00ab1763920280f76e2b4497898858af (patch)
treef025371acd895680336026ebdff7ffa8a4db25d3 /tests/unittests/test_distros/test_user_data_normalize.py
parentf6b318947d0be752e7c93708413929802006a66e (diff)
downloadvyos-cloud-init-4ba4df2f00ab1763920280f76e2b4497898858af.tar.gz
vyos-cloud-init-4ba4df2f00ab1763920280f76e2b4497898858af.zip
run flake8 instead of pyflakes in tox. expect tests/ to pass flake8.
Diffstat (limited to 'tests/unittests/test_distros/test_user_data_normalize.py')
-rw-r--r--tests/unittests/test_distros/test_user_data_normalize.py74
1 files changed, 35 insertions, 39 deletions
diff --git a/tests/unittests/test_distros/test_user_data_normalize.py b/tests/unittests/test_distros/test_user_data_normalize.py
index 4525f487..a887a930 100644
--- a/tests/unittests/test_distros/test_user_data_normalize.py
+++ b/tests/unittests/test_distros/test_user_data_normalize.py
@@ -33,20 +33,19 @@ class TestUGNormalize(TestCase):
def test_group_dict(self):
distro = self._make_distro('ubuntu')
- g = {'groups': [
- {'ubuntu': ['foo', 'bar'],
- 'bob': 'users'},
- 'cloud-users',
- {'bob': 'users2'}
- ]}
+ g = {'groups':
+ [{'ubuntu': ['foo', 'bar'],
+ 'bob': 'users'},
+ 'cloud-users',
+ {'bob': 'users2'}]}
(_users, groups) = self._norm(g, distro)
self.assertIn('ubuntu', groups)
ub_members = groups['ubuntu']
- self.assertEquals(sorted(['foo', 'bar']), sorted(ub_members))
+ self.assertEqual(sorted(['foo', 'bar']), sorted(ub_members))
self.assertIn('bob', groups)
b_members = groups['bob']
- self.assertEquals(sorted(['users', 'users2']),
- sorted(b_members))
+ self.assertEqual(sorted(['users', 'users2']),
+ sorted(b_members))
def test_basic_groups(self):
distro = self._make_distro('ubuntu')
@@ -55,7 +54,7 @@ class TestUGNormalize(TestCase):
}
(users, groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_csv_groups(self):
distro = self._make_distro('ubuntu')
@@ -66,7 +65,7 @@ class TestUGNormalize(TestCase):
self.assertIn('bob', groups)
self.assertIn('joe', groups)
self.assertIn('steve', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_more_groups(self):
distro = self._make_distro('ubuntu')
@@ -77,7 +76,7 @@ class TestUGNormalize(TestCase):
self.assertIn('bob', groups)
self.assertIn('joe', groups)
self.assertIn('steve', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_member_groups(self):
distro = self._make_distro('ubuntu')
@@ -90,11 +89,11 @@ class TestUGNormalize(TestCase):
}
(users, groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', groups)
- self.assertEquals(['s'], groups['bob'])
- self.assertEquals([], groups['joe'])
+ self.assertEqual(['s'], groups['bob'])
+ self.assertEqual([], groups['joe'])
self.assertIn('joe', groups)
self.assertIn('steve', groups)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_users_simple_dict(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -128,14 +127,14 @@ class TestUGNormalize(TestCase):
}
}
(users, _groups) = self._norm(ug_cfg, distro)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
ug_cfg = {
'users': {
'default': 'no',
}
}
(users, _groups) = self._norm(ug_cfg, distro)
- self.assertEquals({}, users)
+ self.assertEqual({}, users)
def test_users_simple_csv(self):
distro = self._make_distro('ubuntu')
@@ -145,8 +144,8 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])
def test_users_simple(self):
distro = self._make_distro('ubuntu')
@@ -159,8 +158,8 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])
def test_users_old_user(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -211,8 +210,8 @@ class TestUGNormalize(TestCase):
self.assertIn('zetta', users)
ug_cfg = {}
(users, groups) = self._norm(ug_cfg, distro)
- self.assertEquals({}, users)
- self.assertEquals({}, groups)
+ self.assertEqual({}, users)
+ self.assertEqual({}, groups)
def test_users_dict_default_additional(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -223,12 +222,10 @@ class TestUGNormalize(TestCase):
}
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', users)
- self.assertEquals(",".join(distro.get_default_user()['groups']),
- users['bob']['groups'])
- self.assertEquals(True,
- users['bob']['blah'])
- self.assertEquals(True,
- users['bob']['default'])
+ self.assertEqual(",".join(distro.get_default_user()['groups']),
+ users['bob']['groups'])
+ self.assertEqual(True, users['bob']['blah'])
+ self.assertEqual(True, users['bob']['default'])
def test_users_dict_extract(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -240,7 +237,7 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', users)
(name, config) = distros.extract_default(users)
- self.assertEquals(name, 'bob')
+ self.assertEqual(name, 'bob')
expected_config = {}
def_config = None
try:
@@ -255,7 +252,7 @@ class TestUGNormalize(TestCase):
expected_config.pop('name', None)
expected_config.pop('groups', None)
config.pop('groups', None)
- self.assertEquals(config, expected_config)
+ self.assertEqual(config, expected_config)
def test_users_dict_default(self):
distro = self._make_distro('ubuntu', bcfg)
@@ -266,10 +263,9 @@ class TestUGNormalize(TestCase):
}
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('bob', users)
- self.assertEquals(",".join(distro.get_default_user()['groups']),
- users['bob']['groups'])
- self.assertEquals(True,
- users['bob']['default'])
+ self.assertEqual(",".join(distro.get_default_user()['groups']),
+ users['bob']['groups'])
+ self.assertEqual(True, users['bob']['default'])
def test_users_dict_trans(self):
distro = self._make_distro('ubuntu')
@@ -283,8 +279,8 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'tr_me': True, 'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'tr_me': True, 'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])
def test_users_dict(self):
distro = self._make_distro('ubuntu')
@@ -297,5 +293,5 @@ class TestUGNormalize(TestCase):
(users, _groups) = self._norm(ug_cfg, distro)
self.assertIn('joe', users)
self.assertIn('bob', users)
- self.assertEquals({'default': False}, users['joe'])
- self.assertEquals({'default': False}, users['bob'])
+ self.assertEqual({'default': False}, users['joe'])
+ self.assertEqual({'default': False}, users['bob'])