31 lines
519 B
Python
31 lines
519 B
Python
|
import json
|
||
|
import os
|
||
|
|
||
|
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_log_code_get(client):
|
||
|
r = client.get('/sync')
|
||
|
|
||
|
assert r.status_code == 405
|
||
|
|
||
|
|
||
|
def test_log_code_post(client):
|
||
|
data = {
|
||
|
"uuid": os.environ["LOCAL_UUID"],
|
||
|
"message": "Hello There!"
|
||
|
}
|
||
|
r = client.post('/sync', data = json.dumps(data))
|
||
|
|
||
|
assert r.status_code == 204
|