Пример #1
0
    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)
Пример #2
0
    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)
Пример #4
0
    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)
Пример #5
0
 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)
Пример #6
0
 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)
Пример #7
0
 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)
Пример #8
0
 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)