def test_null_alias(self): user1 = User(self.db) all_alias = user1.get_all_alias() self.assertEqual(len(list(all_alias)), 0, "No alias should be in DB for new user") all_alias = user1.get_alias_by_type(pynimbusauthz.alias_type_s3) self.assertEqual(len(list(all_alias)), 0, "No alias should be in DB for new user")
def test_alias_lookup(self): user1 = User(self.db) alias1 = user1.create_alias("/name/", pynimbusauthz.alias_type_s3, "1") aliasX = user1.create_alias("/name2", pynimbusauthz.alias_type_s3, "2") aliasX = user1.create_alias("/name3", pynimbusauthz.alias_type_s3, "3") aliasX = user1.create_alias("/name4", pynimbusauthz.alias_type_s3, "4") all_alias = user1.get_all_alias() found = False for a in all_alias: if a.get_name() == alias1.get_name() and a.get_type() == alias1.get_type(): found = True self.assertTrue(found, "We should have found the alias") all_alias = user1.get_alias_by_type(pynimbusauthz.alias_type_s3) found = False for a in all_alias: if a.get_name() == alias1.get_name() and a.get_type() == alias1.get_type(): found = True self.assertTrue(found, "We should have found the alias")
def test_alias_lookup(self): user1 = User(self.db) alias1 = user1.create_alias("/name/", pynimbusauthz.alias_type_s3, "1") aliasX = user1.create_alias("/name2", pynimbusauthz.alias_type_s3, "2") aliasX = user1.create_alias("/name3", pynimbusauthz.alias_type_s3, "3") aliasX = user1.create_alias("/name4", pynimbusauthz.alias_type_s3, "4") all_alias = user1.get_all_alias() found = False for a in all_alias: if a.get_name() == alias1.get_name() and a.get_type( ) == alias1.get_type(): found = True self.assertTrue(found, "We should have found the alias") all_alias = user1.get_alias_by_type(pynimbusauthz.alias_type_s3) found = False for a in all_alias: if a.get_name() == alias1.get_name() and a.get_type( ) == alias1.get_type(): found = True self.assertTrue(found, "We should have found the alias")