aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/web_coverage.py65
1 files changed, 51 insertions, 14 deletions
diff --git a/python/tests/web_coverage.py b/python/tests/web_coverage.py
index 3af4e719..c6fba427 100644
--- a/python/tests/web_coverage.py
+++ b/python/tests/web_coverage.py
@@ -14,7 +14,23 @@ def test_container_coverage(app, mocker):
'container_stats': {'buckets': {
'is_preserved': {'doc_count': 461939},
'in_kbart': {'doc_count': 461939},
- 'in_web': {'doc_count': 2797}}}},
+ '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
@@ -25,24 +41,45 @@ def test_container_coverage(app, mocker):
'timed_out': False,
'_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0},
'hits': {'total': 4327, 'max_score': 0.0, 'hits': []},
- 'aggregations': {'year_in_ia': {
- 'after_key': {'year': 2020.0, 'in_ia': True},
- 'buckets': [
- {'key': {'year': 2004.0, 'in_ia': False}, 'doc_count': 4},
- {'key': {'year': 2004.0, 'in_ia': True}, 'doc_count': 68},
- {'key': {'year': 2005.0, 'in_ia': False}, 'doc_count': 26},
- {'key': {'year': 2005.0, 'in_ia': True}, 'doc_count': 428},
- {'key': {'year': 2006.0, 'in_ia': False}, 'doc_count': 14},
- {'key': {'year': 2006.0, 'in_ia': True}, 'doc_count': 487},
- {'key': {'year': 2007.0, 'in_ia': False}, 'doc_count': 13},
- {'key': {'year': 2007.0, 'in_ia': True}, 'doc_count': 345},
- ],
- }},
+ 'aggregations': {
+ 'year_in_ia': {
+ 'after_key': {'year': 2020.0, 'in_ia': True},
+ 'buckets': [
+ {'key': {'year': 2004.0, 'in_ia': False}, 'doc_count': 4},
+ {'key': {'year': 2004.0, 'in_ia': True}, 'doc_count': 68},
+ {'key': {'year': 2005.0, 'in_ia': False}, 'doc_count': 26},
+ {'key': {'year': 2005.0, 'in_ia': True}, 'doc_count': 428},
+ {'key': {'year': 2006.0, 'in_ia': False}, 'doc_count': 14},
+ {'key': {'year': 2006.0, 'in_ia': True}, 'doc_count': 487},
+ {'key': {'year': 2007.0, 'in_ia': False}, 'doc_count': 13},
+ {'key': {'year': 2007.0, 'in_ia': True}, 'doc_count': 345},
+ ],
+ },
+ },
+ }
+
+ elastic_resp3 = {
+ 'took': 294,
+ 'timed_out': False,
+ '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0},
+ 'hits': {'total': 4327, 'max_score': 0.0, 'hits': []},
+ 'aggregations': {
+ 'type_preservation': {
+ 'buckets': [
+ {'key': {'release_type': 'article-journal', 'preservation': 'bright'}, 'doc_count': 444},
+ {'key': {'release_type': 'book', 'preservation': 'dark'}, 'doc_count': 111},
+ ],
+ 'sum_other_doc_count': 0,
+ },
+ },
}
es_raw = mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request')
es_raw.side_effect = [
+ # status
(200, {}, json.dumps(elastic_resp1)),
+ # type preservation histogram
+ (200, {}, json.dumps(elastic_resp3)),
]
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaam/coverage')