From f16cb15a4360e6fb818db8409508d6f9352127e0 Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Mon, 17 May 2021 10:47:17 +0000 Subject: [PATCH] #223: Add test cases for the bug fixed in previous commit --- test/db/endpoints/test_get_with_filters.py | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/test/db/endpoints/test_get_with_filters.py b/test/db/endpoints/test_get_with_filters.py index 6844cada..e43e6b76 100644 --- a/test/db/endpoints/test_get_with_filters.py +++ b/test/db/endpoints/test_get_with_filters.py @@ -54,6 +54,19 @@ def test_valid_get_with_filters_multiple_distinct( [{"title": "Title for DataGateway API Testing (DB) 0"}], id="Single unrelated distinct field", ), + pytest.param( + '"investigationInstruments.createTime"', + [ + { + "investigationInstruments": { + "createTime": DateHandler.datetime_object_to_str( + Constants.TEST_MOD_CREATE_DATETIME, + ), + }, + }, + ], + id="Single related distinct field", + ), pytest.param( '["createTime", "investigationInstruments.createTime"]', [ @@ -68,7 +81,21 @@ def test_valid_get_with_filters_multiple_distinct( }, }, ], - id="List containing related distinct field", + id="Single related distinct field with unrelated field", + ), + pytest.param( + '["investigationInstruments.createTime", "facility.id"]', + [ + { + "facility": {"id": 1}, + "investigationInstruments": { + "createTime": DateHandler.datetime_object_to_str( + Constants.TEST_MOD_CREATE_DATETIME, + ), + }, + }, + ], + id="Multiple related distinct fields", ), pytest.param( '["createTime", "investigationInstruments.createTime", "facility.id"]', @@ -85,7 +112,7 @@ def test_valid_get_with_filters_multiple_distinct( }, }, ], - id="Multiple related distinct fields", + id="Multiple related distinct fields with unrelated field", ), ], )