summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-11-09 15:28:35 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-11-09 15:28:35 -0800
commit1169dcc5f18fd9a5adbf353bec87e48d563550a5 (patch)
tree3ba0b5ce7972c4810498e6373cdcc3dd19a5ae29 /tests/unittests/test_distros
parent0bd973791f05f1d7f94e91b354015789b6b608dc (diff)
downloadvyos-cloud-init-1169dcc5f18fd9a5adbf353bec87e48d563550a5.tar.gz
vyos-cloud-init-1169dcc5f18fd9a5adbf353bec87e48d563550a5.zip
Fix the merging of group configuration
when that group configuration is a dict => members. LP: #1077245
Diffstat (limited to 'tests/unittests/test_distros')
-rw-r--r--tests/unittests/test_distros/test_user_data_normalize.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unittests/test_distros/test_user_data_normalize.py b/tests/unittests/test_distros/test_user_data_normalize.py
index 8f0d8896..50400c8a 100644
--- a/tests/unittests/test_distros/test_user_data_normalize.py
+++ b/tests/unittests/test_distros/test_user_data_normalize.py
@@ -30,6 +30,28 @@ class TestUGNormalize(MockerTestCase):
def _norm(self, cfg, distro):
return distros.normalize_users_groups(cfg, distro)
+ def test_group_dict(self):
+ distro = self._make_distro('ubuntu')
+ 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.assertIn('bob', groups)
+ b_members = groups['bob']
+ self.assertEquals(sorted(['users', 'users2']),
+ sorted(b_members))
+
def test_basic_groups(self):
distro = self._make_distro('ubuntu')
ug_cfg = {