31 lines
548 B
Python
31 lines
548 B
Python
import db
|
|
import pytest
|
|
|
|
@pytest.fixture
|
|
def client(mocker):
|
|
mocker.patch("db.redis_client")
|
|
db.redis_client.get.side_effect=lambda a: None
|
|
|
|
from app import app
|
|
|
|
app.config['TESTING'] = True
|
|
|
|
with app.test_client() as client:
|
|
yield client
|
|
|
|
|
|
def test_log_code_get(client):
|
|
r = client.get('/log')
|
|
|
|
assert r.status_code == 405
|
|
|
|
|
|
def test_log_code_post(client):
|
|
data = {
|
|
"uuid": "asdasdasd",
|
|
"message": "Hello There!"
|
|
}
|
|
r = client.post('/log', json=data)
|
|
|
|
assert r.status_code == 204
|