def test_save_key(self): auth_db.save_key(BOOLIO_KEY, USER_ID, self.callback) result, error = self.wait() self.assertIs(error, None) auth_db.get_user_id(BOOLIO_KEY, self.callback) result, error = self.wait() self.assertIs(error, None) self.assertEqual(result["user_id"], USER_ID)
def wrapper(self, data): @mongo_callback(self) def find_callback(result): if not result: raise AuthError() self.user_id = result["user_id"] func(self, data=data) indico_key = self.request.headers.get("indico_key") if not indico_key: raise AuthError() AuthDB.get_user_id(indico_key, find_callback)
def test_bad_calls(self): random_object = object() auth_db.get_user_id(random_object, self.callback) result, error = self.wait() self.assertIs(result, None) self.assertIsNot(error, None)
def test_get_user_id(self): auth_db.get_user_id(BOOLIO_KEY, self.callback) result, error = self.wait() self.assertIs(error, None) self.assertIs(result, None)