This repository has been archived on 2020-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
consumer-api/consumer_api/tests/log_view_test.py

31 lines
517 B
Python
Raw Normal View History

2020-05-08 21:08:37 +02:00
import json
import os
2020-05-08 20:55:47 +02:00
import pytest
from flask import current_app
@pytest.fixture
2020-05-08 21:02:49 +02:00
def client():
current_app.config['TESTING'] = True
2020-05-08 20:55:47 +02:00
2020-05-08 21:02:49 +02:00
with current_app.test_client() as client:
2020-05-08 21:03:40 +02:00
yield client
2020-05-08 21:02:49 +02:00
2020-05-08 21:08:37 +02:00
2020-05-08 21:02:49 +02:00
def test_log_code_get(client):
r = client.get('/log')
assert r.status_code == 405
2020-05-08 21:08:37 +02:00
2020-05-08 21:02:49 +02:00
def test_log_code_post(client):
2020-05-08 21:08:37 +02:00
data = {
"uuid": os.environ["LOCAL_UUID"],
"message": "Hello There!"
}
r = client.post('/log', data = json.dumps(data))
2020-05-08 20:55:47 +02:00
assert r.status_code == 204