Пример #1
0
 def test_multiple_providers(self):
     provider = CombinedGroupProvider(
         PreconfiguredGroupProvider({'group1': ['user1', 'user2']}),
         PreconfiguredGroupProvider({'group2': ['user3', 'user4']}),
         PreconfiguredGroupProvider({'group3': ['user2', 'user5']}))
     self.assertCountEqual(provider.get_groups('user2'),
                           ['group1', 'group3'])
Пример #2
0
 def test_known_groups_when_multiple_provider(self):
     provider = CombinedGroupProvider(
         PreconfiguredGroupProvider({'group1': ['@lazy1', 'user1']}),
         PreconfiguredGroupProvider({'group2': ['userX', 'user2']}),
         PreconfiguredGroupProvider({'group3': ['user3']}),
         PreconfiguredGroupProvider({'group4': ['@lazy4', 'user4']}))
     self.assertCountEqual(provider.get_groups('userX', ['lazy1', 'lazy4']), ['group1', 'group2', 'group4'])
Пример #3
0
 def test_known_groups_when_single_provider(self):
     provider = CombinedGroupProvider(
         PreconfiguredGroupProvider({'group1': ['user1', '@lazy1']}))
     self.assertCountEqual(provider.get_groups('user2', ['lazy1']),
                           ['group1'])
Пример #4
0
 def test_single_provider(self):
     provider = CombinedGroupProvider(
         PreconfiguredGroupProvider({'group1': ['user1', 'user2']}))
     self.assertCountEqual(provider.get_groups('user1'), ['group1'])