Compare commits

..

No commits in common. "89522c0536fb65fb416a19085d4587de25f01c30" and "4e66533cbcae91363f533ad41e56a9937aa31679" have entirely different histories.

7 changed files with 37 additions and 44 deletions

View File

@ -1,2 +0,0 @@
[run]
omit=venv/*

View File

@ -1,5 +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

@ -1,22 +1,21 @@
import db
import json
import os
import pytest
from flask import current_app
@pytest.fixture
def client(mocker):
mocker.patch("db.redis_client")
db.redis_client.get.side_effect=lambda a: None
def client():
current_app.config['TESTING'] = True
from app import app
app.config['TESTING'] = True
with app.test_client() as client:
with current_app.test_client() as client:
yield client
def test_response_length(client):
r = client.get('/consumers')
assert r.status_code == 200
data = {
"uuid": os.environ["LOCAL_UUID"],
"message": "Hello There!"
}
r = client.get('/consumers', data = json.dumps(data))
assert len(r) == 0

View File

@ -1,16 +1,16 @@
import db
import json
import os
import pytest
from flask import current_app
@pytest.fixture
def client(mocker):
mocker.patch("db.redis_client")
db.redis_client.get.side_effect=lambda a: None
def client():
current_app.config['TESTING'] = True
from app import app
app.config['TESTING'] = True
with app.test_client() as client:
with current_app.test_client() as client:
yield client
@ -22,9 +22,9 @@ def test_log_code_get(client):
def test_log_code_post(client):
data = {
"uuid": "asdasdasd",
"uuid": os.environ["LOCAL_UUID"],
"message": "Hello There!"
}
r = client.post('/log', json=data)
r = client.post('/log', data = json.dumps(data))
assert r.status_code == 204

View File

@ -1,20 +1,19 @@
import db
import json
import os
import pytest
from flask import current_app
@pytest.fixture
def client(mocker):
mocker.patch("db.redis_client")
db.redis_client.get.side_effect=lambda a: None
def client():
current_app.config['TESTING'] = True
from app import app
app.config['TESTING'] = True
with app.test_client() as client:
with current_app.test_client() as client:
yield client
def test_log_code_get(client):
r = client.get('/sync')
@ -23,8 +22,8 @@ def test_log_code_get(client):
def test_log_code_post(client):
data = {
"uuid": "tesuuid"
"uuid": os.environ["LOCAL_UUID"]
}
r = client.post('/sync', json=data)
r = client.post('/sync', data = json.dumps(data))
assert r.status_code == 200
assert r.status_code == 204

View File

@ -1,7 +1,7 @@
import json
from db import redis_client
from flask import jsonify
from flask import jsonify, request
from flask_classful import FlaskView

View File

@ -1,4 +0,0 @@
pytest
pytest-mock
mock
coverage