diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-24 13:00:04 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-30 18:28:03 -0700 |
commit | 1f6f9c0e251f45f220dd48242d48fa61922fe55f (patch) | |
tree | 41a85d22339279c6bc29661e3541f2696d580f23 /python/tests/web_entity_views.py | |
parent | 86c150edadad347df31393742c2de091ff21da83 (diff) | |
download | fatcat-1f6f9c0e251f45f220dd48242d48fa61922fe55f.tar.gz fatcat-1f6f9c0e251f45f220dd48242d48fa61922fe55f.zip |
refactor coverage tests/mocks
Diffstat (limited to 'python/tests/web_entity_views.py')
-rw-r--r-- | python/tests/web_entity_views.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/python/tests/web_entity_views.py b/python/tests/web_entity_views.py index c1cbdc29..b01bd815 100644 --- a/python/tests/web_entity_views.py +++ b/python/tests/web_entity_views.py @@ -1,4 +1,5 @@ +import json from fixtures import * from fatcat_web.forms import ReleaseEntityForm, FileEntityForm, ContainerEntityForm @@ -25,7 +26,14 @@ REALISTIC_DEMO_ENTITIES = { } -def test_entity_basics(app): +def test_entity_basics(app, mocker): + + es_raw = mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request') + # these are basic ES stats for the container view pages + es_raw.side_effect = [ + (200, {}, json.dumps(ES_CONTAINER_STATS_RESP)), + (200, {}, json.dumps(ES_CONTAINER_RANDOM_RESP)), + ] for entity_type, (ident, revision) in DUMMY_DEMO_ENTITIES.items(): # good requests @@ -132,7 +140,14 @@ def test_lookups(app): assert rv.status_code == 404 -def test_web_container(app): +def test_web_container(app, mocker): + + es_raw = mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request') + # these are basic ES stats for the container view pages + es_raw.side_effect = [ + (200, {}, json.dumps(ES_CONTAINER_STATS_RESP)), + (200, {}, json.dumps(ES_CONTAINER_RANDOM_RESP)), + ] rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaai') assert rv.status_code == 200 |