tests definded
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Füleki Fábián 2020-05-08 20:55:47 +02:00
parent f643b91a8b
commit c58b6449aa
2 changed files with 16 additions and 22 deletions

View File

@ -4,26 +4,7 @@ from flask import current_app
@pytest.fixture @pytest.fixture
def client(): def test_response_length(client):
current_app.config["TESTING"] = True r = client.get('/log')
with current_app.test_client() as client: assert len(r) == 0
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

View 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