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

This commit is contained in:
Füleki Fábián 2020-05-08 20:36:45 +02:00
parent d6b8c528de
commit f643b91a8b
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import os
# Setup environment variables for testing
os.environ["INITIAL_SERVERS"] = "192.168.111.22"
os.environ["LOCAL_UUID"] = "d8b2e5e2-f675-4194-9324-af58e4b70c54"
os.environ["REDIS_URL"] = "redis://192.168.111.121/0"

View File

@ -0,0 +1,29 @@
import pytest
from flask import current_app
@pytest.fixture
def client():
current_app.config["TESTING"] = True
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