This commit is contained in:
parent
f643b91a8b
commit
c58b6449aa
@ -4,26 +4,7 @@ from flask import current_app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
current_app.config["TESTING"] = True
|
||||
def test_response_length(client):
|
||||
r = client.get('/log')
|
||||
|
||||
with current_app.test_client() as client:
|
||||
yield client
|
||||
|
||||
|
||||
def test_access_denied(client):
|
||||
r = client.get('/api/user')
|
||||
|
||||
assert r.status_code == 401
|
||||
|
||||
|
||||
def test_access_denied2(client):
|
||||
r = client.get('/api/user', headers = { "Authorization": "invalidkey" })
|
||||
|
||||
assert r.status_code == 401
|
||||
|
||||
|
||||
def test_empty_database(client):
|
||||
r = client.get('/api/user', headers = { "Authorization": "testkey" })
|
||||
|
||||
assert len(r.json) == 0
|
||||
assert len(r) == 0
|
||||
|
13
consumer_api/tests/log_view_test.py
Normal file
13
consumer_api/tests/log_view_test.py
Normal file
@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
|
||||
from flask import current_app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
def test_log_code(client):
|
||||
r = client.get('/log')
|
||||
|
||||
assert r.status_code == 204
|
||||
|
||||
|
Reference in New Issue
Block a user