Skip to content
Snippets Groups Projects
Commit aafef5e0 authored by Erik Reid's avatar Erik Reid
Browse files

use saved test data for tests

parent 9c0d0c1d
No related branches found
No related tags found
No related merge requests found
...@@ -49,5 +49,5 @@ def abc(): ...@@ -49,5 +49,5 @@ def abc():
host=redis_config["hostname"], host=redis_config["hostname"],
port=redis_config["port"]) port=redis_config["port"])
return Response( return Response(
json.dumps(r.keys("*")), json.dumps(list(r.keys("*"))),
mimetype="application/json") mimetype="application/json")
...@@ -166,18 +166,25 @@ def test_version_request(client): ...@@ -166,18 +166,25 @@ def test_version_request(client):
version_schema) version_schema)
TEST_DATA_FILENAME = os.path.join(
os.path.dirname(__file__),
"router-info.json")
class MockedRedis(object): class MockedRedis(object):
db = {} db = None
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
pass if MockedRedis.db is None:
with open(TEST_DATA_FILENAME) as f:
MockedRedis.db = json.loads(f.read())
def set(self, key, value): def set(self, key, value):
MockedRedis.db[key] = value MockedRedis.db[key] = value
def keys(self, *args, **kwargs): def keys(self, *args, **kwargs):
return ["a", "b", "c"] return MockedRedis.db.keys()
def test_abc(mocker, client): def test_abc(mocker, client):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment