Пример #1
0
 def test_get_api_keys(self):
     user = db_utils.create_user()
     self.assertEqual(0, api.get_api_keys(user).rowcount)
     token = "some token"
     db_utils.create_api_key(user, token)
     self.assertEqual(1, api.get_api_keys(user).rowcount)
     self.assertEqual(token, api.get_api_keys(user).first()["token"])
Пример #2
0
def control_apikeys_get_(request):
    return Response(
        define.webpage(request.userid,
                       "control/edit_apikeys.html", [
                           api.get_api_keys(request.userid),
                           oauth2.get_consumers_for_user(request.userid),
                       ],
                       title="API Keys"))
Пример #3
0
def control_apikeys_get_(request):
    return Response(define.webpage(request.userid, "control/edit_apikeys.html", [
        api.get_api_keys(request.userid),
        oauth2.get_consumers_for_user(request.userid),
    ]))
Пример #4
0
 def GET(self):
     return define.webpage(self.user_id, "control/edit_apikeys.html", [
         api.get_api_keys(self.user_id),
         oauth2.get_consumers_for_user(self.user_id),
     ])
Пример #5
0
 def test_delete_api_keys(self):
     user = db_utils.create_user()
     token = "some token"
     db_utils.create_api_key(user, token)
     api.delete_api_keys(user, [token])
     self.assertEqual(0, api.get_api_keys(user).rowcount)
Пример #6
0
 def test_add_api_key(self):
     user = db_utils.create_user()
     api.add_api_key(user, "")
     self.assertEqual(1, api.get_api_keys(user).rowcount)
Пример #7
0
 def GET(self):
     return define.webpage(self.user_id, "control/edit_apikeys.html", [
         api.get_api_keys(self.user_id),
         oauth2.get_consumers_for_user(self.user_id),
     ])