Skip to content

Commit

Permalink
Convert ugm posix groups doctests to unittests done
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Apr 14, 2019
1 parent c3463db commit 0c5ea12
Show file tree
Hide file tree
Showing 4 changed files with 599 additions and 5 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/node/ext/ldap/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_suite():

from node.ext.ldap.tests import test_ugm_defaults
from node.ext.ldap.tests import test_ugm_group_of_names
from node.ext.ldap.tests import test_ugm_posix_groups

suite = unittest.TestSuite()

Expand All @@ -26,6 +27,7 @@ def test_suite():

suite.addTest(unittest.findTestCases(test_ugm_defaults))
suite.addTest(unittest.findTestCases(test_ugm_group_of_names))
suite.addTest(unittest.findTestCases(test_ugm_posix_groups))

return suite

Expand Down
13 changes: 8 additions & 5 deletions src/node/ext/ldap/tests/test_ugm_group_of_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def test_group_memebership(self, ugm):
group_0 = groups['group0']
group_1 = groups['group1']
group_2 = groups['group2']

self.assertEqual(group_0.member_ids, [])
self.assertEqual(group_1.member_ids, ['uid1'])
self.assertEqual(group_2.member_ids, ['uid1', 'uid2'])
Expand Down Expand Up @@ -293,11 +294,13 @@ def test_group_memebership(self, ugm):

# A user knows its groups
self.assertEqual(user_0.groups, [])
self.assertEqual(
user_1.groups,
[ugm_fresh.groups['group1'], ugm_fresh.groups['group2']]
)
self.assertEqual(user_2.groups, [ugm_fresh.groups['group2']])
self.assertEqual(user_1.groups, [
ugm_fresh.groups['group1'],
ugm_fresh.groups['group2']
])
self.assertEqual(user_2.groups, [
ugm_fresh.groups['group2']
])
self.assertEqual(user_1.group_ids, [u'group1', u'group2'])
self.assertEqual(user_2.group_ids, [u'group2'])

Expand Down
Loading

0 comments on commit 0c5ea12

Please sign in to comment.