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'])
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'])
def test_known_groups_when_single_provider(self): provider = CombinedGroupProvider( PreconfiguredGroupProvider({'group1': ['user1', '@lazy1']})) self.assertCountEqual(provider.get_groups('user2', ['lazy1']), ['group1'])
def test_single_provider(self): provider = CombinedGroupProvider( PreconfiguredGroupProvider({'group1': ['user1', 'user2']})) self.assertCountEqual(provider.get_groups('user1'), ['group1'])