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/sync_view_test.py

31 lines
514 B
Python
Raw Normal View History

2020-05-14 13:54:19 +02:00
import db
2020-05-08 21:25:18 +02:00
import pytest
2020-05-14 13:54:19 +02:00
@pytest.fixture
def client(mocker):
mocker.patch("db.redis_client")
db.redis_client.get.side_effect=lambda a: None
2020-05-08 21:25:18 +02:00
2020-05-14 13:54:19 +02:00
from app import app
2020-05-08 21:25:18 +02:00
2020-05-14 13:54:19 +02:00
app.config['TESTING'] = True
2020-05-08 21:25:18 +02:00
2020-05-14 13:54:19 +02:00
with app.test_client() as client:
2020-05-08 21:25:18 +02:00
yield client
2020-05-14 13:54:19 +02:00
2020-05-08 21:25:18 +02:00
def test_log_code_get(client):
r = client.get('/sync')
assert r.status_code == 405
def test_log_code_post(client):
data = {
2020-05-14 13:54:19 +02:00
"uuid": "tesuuid"
2020-05-08 21:25:18 +02:00
}
2020-05-14 13:54:19 +02:00
r = client.post('/sync', json=data)
2020-05-08 21:25:18 +02:00
2020-05-14 13:54:19 +02:00
assert r.status_code == 200