def test_get_multi_associations_with_one_missing(self): gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid1', 'uid1')) # The aid2 <-> uid2 association is missing. gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid3', 'uid3')) self.assertEqual( gae_auth_services.get_multi_user_ids_from_auth_ids( ['aid1', 'aid2', 'aid3']), ['uid1', None, 'uid3']) self.assertEqual( gae_auth_services.get_multi_auth_ids_from_user_ids( ['uid1', 'uid2', 'uid3']), ['aid1', None, 'aid3'])
def assert_gae_assoc_does_not_exist_multi(self, assocs): """Asserts that the given users' GAE association doesn't exist. Args: assocs: list(AuthIdUserIdPair). The associations to check. """ auth_ids, user_ids = (list(a) for a in python_utils.ZIP(*assocs)) self.assertEqual( gae_auth_services.get_multi_user_ids_from_auth_ids(auth_ids), [None] * len(auth_ids)) self.assertEqual( gae_auth_services.get_multi_auth_ids_from_user_ids(user_ids), [None] * len(user_ids))
def test_get_multi_associations_with_all_present(self): gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid1', 'uid1')) gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid2', 'uid2')) gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid3', 'uid3')) self.assertEqual( gae_auth_services.get_multi_user_ids_from_auth_ids( ['aid1', 'aid2', 'aid3']), ['uid1', 'uid2', 'uid3']) self.assertEqual( gae_auth_services.get_multi_auth_ids_from_user_ids( ['uid1', 'uid2', 'uid3']), ['aid1', 'aid2', 'aid3'])