mirror of
https://github.com/kevin-DL/ShortMe-URL-Shortener.git
synced 2026-01-11 19:14:29 +00:00
Initial commit
This commit is contained in:
18
app/tests/api_testing/api_helper.py
Normal file
18
app/tests/api_testing/api_helper.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import json
|
||||
from app.app import app as a
|
||||
|
||||
|
||||
class ApiHelper:
|
||||
HEADERS = {
|
||||
'Authorization': f'Bearer {a.secret_key}'
|
||||
}
|
||||
|
||||
def get_auth_token(self, app):
|
||||
r = app.test_client().get(
|
||||
'/api/get_token', headers=self.HEADERS
|
||||
)
|
||||
|
||||
print(r.get_data(as_text=True))
|
||||
|
||||
key = json.loads(r.get_data(as_text=True))
|
||||
return key
|
||||
Reference in New Issue
Block a user