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"])
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"))
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), ]))
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), ])
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)
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)