def test_associate_multi_with_user_id_collision_raises(self): gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid1', 'uid1')) with self.assertRaisesRegexp(Exception, 'already associated'): gae_auth_services.associate_multi_auth_ids_with_user_ids( [auth_domain.AuthIdUserIdPair('aid1', 'uid1'), auth_domain.AuthIdUserIdPair('aid2', 'uid2'), auth_domain.AuthIdUserIdPair('aid3', 'uid3')])
def test_associate_multi_with_auth_id_collision_raises(self): gae_auth_services.associate_auth_id_with_user_id( auth_domain.AuthIdUserIdPair('aid1', 'uid1')) # Erase the user_id collision, but leave the auth_id collision. auth_models.UserIdentifiersModel.delete_by_id('aid1') with self.assertRaisesRegexp(Exception, 'already associated'): gae_auth_services.associate_multi_auth_ids_with_user_ids( [auth_domain.AuthIdUserIdPair('aid1', 'uid1'), auth_domain.AuthIdUserIdPair('aid2', 'uid2'), auth_domain.AuthIdUserIdPair('aid3', 'uid3')])
def test_associate_multi_without_collisions(self): gae_auth_services.associate_multi_auth_ids_with_user_ids( [auth_domain.AuthIdUserIdPair('aid1', 'uid1'), auth_domain.AuthIdUserIdPair('aid2', 'uid2'), auth_domain.AuthIdUserIdPair('aid3', 'uid3')]) self.assertEqual( [gae_auth_services.get_user_id_from_auth_id('aid1'), gae_auth_services.get_user_id_from_auth_id('aid2'), gae_auth_services.get_user_id_from_auth_id('aid3')], ['uid1', 'uid2', 'uid3'])