aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/web_coverage.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-24 13:00:04 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-30 18:28:03 -0700
commit1f6f9c0e251f45f220dd48242d48fa61922fe55f (patch)
tree41a85d22339279c6bc29661e3541f2696d580f23 /python/tests/web_coverage.py
parent86c150edadad347df31393742c2de091ff21da83 (diff)
downloadfatcat-1f6f9c0e251f45f220dd48242d48fa61922fe55f.tar.gz
fatcat-1f6f9c0e251f45f220dd48242d48fa61922fe55f.zip
refactor coverage tests/mocks
Diffstat (limited to 'python/tests/web_coverage.py')
-rw-r--r--python/tests/web_coverage.py38
1 files changed, 5 insertions, 33 deletions
diff --git a/python/tests/web_coverage.py b/python/tests/web_coverage.py
index c6fba427..41b04892 100644
--- a/python/tests/web_coverage.py
+++ b/python/tests/web_coverage.py
@@ -9,34 +9,6 @@ from fixtures import *
def test_container_coverage(app, mocker):
elastic_resp1 = {
- 'timed_out': False,
- 'aggregations': {
- 'container_stats': {'buckets': {
- 'is_preserved': {'doc_count': 461939},
- 'in_kbart': {'doc_count': 461939},
- 'in_web': {'doc_count': 2797},
- }},
- 'preservation': {
- 'buckets': [
- {'key': 'bright', 'doc_count': 444},
- {'key': 'dark', 'doc_count': 111},
- ],
- 'sum_other_doc_count': 0,
- },
- 'release_type': {
- 'buckets': [
- {'key': 'article-journal', 'doc_count': 456},
- {'key': 'book', 'doc_count': 123},
- ],
- 'sum_other_doc_count': 0,
- },
- },
- 'hits': {'total': 461939, 'hits': [], 'max_score': 0.0},
- '_shards': {'successful': 5, 'total': 5, 'skipped': 0, 'failed': 0},
- 'took': 50
- }
-
- elastic_resp2 = {
'took': 294,
'timed_out': False,
'_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0},
@@ -58,7 +30,7 @@ def test_container_coverage(app, mocker):
},
}
- elastic_resp3 = {
+ elastic_resp2 = {
'took': 294,
'timed_out': False,
'_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0},
@@ -77,9 +49,9 @@ def test_container_coverage(app, mocker):
es_raw = mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request')
es_raw.side_effect = [
# status
- (200, {}, json.dumps(elastic_resp1)),
+ (200, {}, json.dumps(ES_CONTAINER_STATS_RESP)),
# type preservation histogram
- (200, {}, json.dumps(elastic_resp3)),
+ (200, {}, json.dumps(elastic_resp2)),
]
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaam/coverage')
@@ -87,14 +59,14 @@ def test_container_coverage(app, mocker):
es_raw = mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request')
es_raw.side_effect = [
- (200, {}, json.dumps(elastic_resp2)),
+ (200, {}, json.dumps(elastic_resp1)),
]
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaam/ia_coverage_years.json')
assert rv.status_code == 200
es_raw.side_effect = [
- (200, {}, json.dumps(elastic_resp2)),
+ (200, {}, json.dumps(elastic_resp1)),
]
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaam/ia_coverage_years.svg')