From 279681a93393d756990fc9ad8b69a27d58fb941f Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Mon, 25 Jan 2021 10:03:52 +0000 Subject: [PATCH] #119: Edit DB backend tests to use camelCase - Most DB tests pass now, but a decision needs to be made regarding foreign keys to allow the tests in test_entity_helper.py to pass --- test/conftest.py | 6 +- test/db/conftest.py | 60 ++--- .../endpoints/test_count_with_filters_db.py | 4 +- test/db/endpoints/test_findone_db.py | 4 +- test/db/endpoints/test_get_by_id_db.py | 8 +- test/db/endpoints/test_get_with_filters.py | 14 +- test/db/endpoints/test_table_endpoints_db.py | 4 +- test/db/test_entity_helper.py | 240 +++++++++--------- test/db/test_query_filter_factory.py | 18 +- test/test_get_filters_from_query.py | 4 +- 10 files changed, 181 insertions(+), 181 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 9d29d01e..d4039374 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -53,12 +53,12 @@ def flask_test_app_db(): @pytest.fixture() def valid_db_credentials_header(): session = SESSION() - session.ID = "Test" - session.EXPIREDATETIME = datetime.now() + timedelta(hours=1) + session.id = "Test" + session.expireDateTime = datetime.now() + timedelta(hours=1) session.username = "Test User" insert_row_into_table(SESSION, session) - yield {"Authorization": f"Bearer {session.ID}"} + yield {"Authorization": f"Bearer {session.id}"} delete_row_by_id(SESSION, "Test") diff --git a/test/db/conftest.py b/test/db/conftest.py index 6977104e..100f5d04 100644 --- a/test/db/conftest.py +++ b/test/db/conftest.py @@ -18,10 +18,10 @@ def set_meta_attributes(entity): db_meta_attributes = { - "CREATE_TIME": Constants.TEST_MOD_CREATE_DATETIME, - "MOD_TIME": Constants.TEST_MOD_CREATE_DATETIME, - "CREATE_ID": "test create id", - "MOD_ID": "test mod id", + "createTime": Constants.TEST_MOD_CREATE_DATETIME, + "modTime": Constants.TEST_MOD_CREATE_DATETIME, + "createId": "test create id", + "modId": "test mod id", } for attr, value in db_meta_attributes.items(): @@ -33,17 +33,17 @@ def create_investigation_db_data(num_entities=1): for i in range(num_entities): investigation = INVESTIGATION() - investigation.NAME = f"Test Data for DataGateway API Testing (DB) {i}" - investigation.TITLE = f"Title for DataGateway API Testing (DB) {i}" - investigation.STARTDATE = datetime( + investigation.name = f"Test Data for DataGateway API Testing (DB) {i}" + investigation.title = f"Title for DataGateway API Testing (DB) {i}" + investigation.startDate = datetime( year=2020, month=1, day=4, hour=1, minute=1, second=1, ) - investigation.ENDDATE = datetime( + investigation.endDate = datetime( year=2020, month=1, day=8, hour=1, minute=1, second=1, ) - investigation.VISIT_ID = str(uuid.uuid1()) - investigation.FACILITY_ID = 1 - investigation.TYPE_ID = 1 + investigation.visitId = str(uuid.uuid1()) + investigation.facility = 1 + investigation.type = 1 set_meta_attributes(investigation) @@ -63,7 +63,7 @@ def single_investigation_test_data_db(): yield investigation - delete_row_by_id(INVESTIGATION, investigation.ID) + delete_row_by_id(INVESTIGATION, investigation.id) @pytest.fixture() @@ -73,57 +73,57 @@ def multiple_investigation_test_data_db(): yield investigations for investigation in investigations: - delete_row_by_id(INVESTIGATION, investigation.ID) + delete_row_by_id(INVESTIGATION, investigation.id) @pytest.fixture() def isis_specific_endpoint_data_db(): facility_cycle = FACILITYCYCLE() - facility_cycle.NAME = "Test cycle for DG API testing (DB)" - facility_cycle.STARTDATE = datetime( + facility_cycle.name = "Test cycle for DG API testing (DB)" + facility_cycle.startDate = datetime( year=2020, month=1, day=1, hour=1, minute=1, second=1, ) - facility_cycle.ENDDATE = datetime( + facility_cycle.endDate = datetime( year=2020, month=2, day=1, hour=1, minute=1, second=1, ) - facility_cycle.FACILITY_ID = 1 + facility_cycle.facility = 1 set_meta_attributes(facility_cycle) insert_row_into_table(FACILITYCYCLE, facility_cycle) investigation = create_investigation_db_data() instrument = INSTRUMENT() - instrument.NAME = "Test Instrument for DataGateway API Endpoint Testing (DB)" - instrument.FACILITY_ID = 1 + instrument.name = "Test Instrument for DataGateway API Endpoint Testing (DB)" + instrument.facility = 1 set_meta_attributes(instrument) insert_row_into_table(INSTRUMENT, instrument) investigation_instrument = INVESTIGATIONINSTRUMENT() - investigation_instrument.INVESTIGATION_ID = investigation.ID - investigation_instrument.INSTRUMENT_ID = instrument.ID + investigation_instrument.investigation = investigation.id + investigation_instrument.instrument = instrument.id set_meta_attributes(investigation_instrument) insert_row_into_table(INVESTIGATIONINSTRUMENT, investigation_instrument) - yield (instrument.ID, facility_cycle, investigation) + yield (instrument.id, facility_cycle, investigation) - delete_row_by_id(INVESTIGATIONINSTRUMENT, investigation_instrument.ID) - delete_row_by_id(FACILITYCYCLE, facility_cycle.ID) - delete_row_by_id(INVESTIGATION, investigation.ID) - delete_row_by_id(INSTRUMENT, instrument.ID) + delete_row_by_id(INVESTIGATIONINSTRUMENT, investigation_instrument.id) + delete_row_by_id(FACILITYCYCLE, facility_cycle.id) + delete_row_by_id(INVESTIGATION, investigation.id) + delete_row_by_id(INSTRUMENT, instrument.id) @pytest.fixture() def final_instrument_id(flask_test_app_db, valid_db_credentials_header): final_instrument_result = flask_test_app_db.get( - '/instruments/findone?order="ID DESC"', headers=valid_db_credentials_header, + '/instruments/findone?order="id DESC"', headers=valid_db_credentials_header, ) - return final_instrument_result.json["ID"] + return final_instrument_result.json["id"] @pytest.fixture() def final_facilitycycle_id(flask_test_app_db, valid_db_credentials_header): final_facilitycycle_result = flask_test_app_db.get( - '/facilitycycles/findone?order="ID DESC"', headers=valid_db_credentials_header, + '/facilitycycles/findone?order="id DESC"', headers=valid_db_credentials_header, ) - return final_facilitycycle_result.json["ID"] + return final_facilitycycle_result.json["id"] diff --git a/test/db/endpoints/test_count_with_filters_db.py b/test/db/endpoints/test_count_with_filters_db.py index 0dd0795d..8be2a91f 100644 --- a/test/db/endpoints/test_count_with_filters_db.py +++ b/test/db/endpoints/test_count_with_filters_db.py @@ -7,7 +7,7 @@ def test_valid_count_with_filters( self, flask_test_app_db, valid_db_credentials_header, ): test_response = flask_test_app_db.get( - '/investigations/count?where={"TITLE": {"like": "Title for DataGateway API' + '/investigations/count?where={"title": {"like": "Title for DataGateway API' ' Testing (DB)"}}', headers=valid_db_credentials_header, ) @@ -18,7 +18,7 @@ def test_valid_no_results_count_with_filters( self, flask_test_app_db, valid_db_credentials_header, ): test_response = flask_test_app_db.get( - '/investigations/count?where={"TITLE": {"like": "This filter should cause a' + '/investigations/count?where={"title": {"like": "This filter should cause a' '404 for testing purposes..."}}', headers=valid_db_credentials_header, ) diff --git a/test/db/endpoints/test_findone_db.py b/test/db/endpoints/test_findone_db.py index 3da73274..f9f5318d 100644 --- a/test/db/endpoints/test_findone_db.py +++ b/test/db/endpoints/test_findone_db.py @@ -6,7 +6,7 @@ def test_valid_findone_with_filters( single_investigation_test_data_db, ): test_response = flask_test_app_db.get( - '/investigations/findone?where={"TITLE": {"like": "Title for DataGateway' + '/investigations/findone?where={"title": {"like": "Title for DataGateway' ' API Testing (DB)"}}', headers=valid_db_credentials_header, ) @@ -17,7 +17,7 @@ def test_valid_no_results_findone_with_filters( self, flask_test_app_db, valid_db_credentials_header, ): test_response = flask_test_app_db.get( - '/investigations/findone?where={"TITLE": {"eq": "This filter should cause a' + '/investigations/findone?where={"title": {"eq": "This filter should cause a' '404 for testing purposes..."}}', headers=valid_db_credentials_header, ) diff --git a/test/db/endpoints/test_get_by_id_db.py b/test/db/endpoints/test_get_by_id_db.py index 3c2932a7..a32a5860 100644 --- a/test/db/endpoints/test_get_by_id_db.py +++ b/test/db/endpoints/test_get_by_id_db.py @@ -7,11 +7,11 @@ def test_valid_get_with_id( ): # Need to identify the ID given to the test data investigation_data = flask_test_app_db.get( - '/investigations?where={"TITLE": {"like": "Title for DataGateway API' + '/investigations?where={"title": {"like": "Title for DataGateway API' ' Testing (DB)"}}', headers=valid_db_credentials_header, ) - test_data_id = investigation_data.json[0]["ID"] + test_data_id = investigation_data.json[0]["id"] test_response = flask_test_app_db.get( f"/investigations/{test_data_id}", headers=valid_db_credentials_header, @@ -23,10 +23,10 @@ def test_invalid_get_with_id( self, flask_test_app_db, valid_db_credentials_header, ): final_investigation_result = flask_test_app_db.get( - '/investigations/findone?order="ID DESC"', + '/investigations/findone?order="id DESC"', headers=valid_db_credentials_header, ) - test_data_id = final_investigation_result.json["ID"] + test_data_id = final_investigation_result.json["id"] # Adding 100 onto the ID to the most recent result should ensure a 404 test_response = flask_test_app_db.get( diff --git a/test/db/endpoints/test_get_with_filters.py b/test/db/endpoints/test_get_with_filters.py index da25b894..d5e8ee19 100644 --- a/test/db/endpoints/test_get_with_filters.py +++ b/test/db/endpoints/test_get_with_filters.py @@ -9,7 +9,7 @@ def test_valid_get_with_filters( single_investigation_test_data_db, ): test_response = flask_test_app_db.get( - '/investigations?where={"TITLE": {"like": "Title for DataGateway API' + '/investigations?where={"title": {"like": "Title for DataGateway API' ' Testing (DB)"}}', headers=valid_db_credentials_header, ) @@ -20,7 +20,7 @@ def test_valid_no_results_get_with_filters( self, flask_test_app_db, valid_db_credentials_header, ): test_response = flask_test_app_db.get( - '/investigations?where={"TITLE": {"eq": "This filter should cause a 404 for' + '/investigations?where={"title": {"eq": "This filter should cause a 404 for' 'testing purposes..."}}', headers=valid_db_credentials_header, ) @@ -32,13 +32,13 @@ def test_valid_get_with_filters_distinct( self, flask_test_app_db, valid_db_credentials_header, ): test_response = flask_test_app_db.get( - '/investigations?where={"TITLE": {"like": "Title for DataGateway API' - ' Testing (DB)"}}&distinct="TITLE"', + '/investigations?where={"title": {"like": "Title for DataGateway API' + ' Testing (DB)"}}&distinct="title"', headers=valid_db_credentials_header, ) expected = [ - {"TITLE": f"Title for DataGateway API Testing (DB) {i}"} for i in range(5) + {"title": f"Title for DataGateway API Testing (DB) {i}"} for i in range(5) ] for title in expected: @@ -54,9 +54,9 @@ def test_limit_skip_merge_get_with_filters( limit_value = 2 test_response = flask_test_app_db.get( - '/investigations?where={"TITLE": {"like": "Title for DataGateway API' + '/investigations?where={"title": {"like": "Title for DataGateway API' ' Testing (DB)"}}' - f'&skip={skip_value}&limit={limit_value}&order="ID ASC"', + f'&skip={skip_value}&limit={limit_value}&order="id ASC"', headers=valid_db_credentials_header, ) diff --git a/test/db/endpoints/test_table_endpoints_db.py b/test/db/endpoints/test_table_endpoints_db.py index 45a95da5..ad6024d4 100644 --- a/test/db/endpoints/test_table_endpoints_db.py +++ b/test/db/endpoints/test_table_endpoints_db.py @@ -58,7 +58,7 @@ def test_valid_get_investigations_with_filters( ): test_response = flask_test_app_db.get( f"/instruments/{isis_specific_endpoint_data_db[0]}/facilitycycles/" - f"{isis_specific_endpoint_data_db[1].to_dict()['ID']}/investigations", + f"{isis_specific_endpoint_data_db[1].to_dict()['id']}/investigations", headers=valid_db_credentials_header, ) @@ -87,7 +87,7 @@ def test_valid_get_investigations_count_with_filters( ): test_response = flask_test_app_db.get( f"/instruments/{isis_specific_endpoint_data_db[0]}/facilitycycles/" - f"{isis_specific_endpoint_data_db[1].to_dict()['ID']}/investigations/count", + f"{isis_specific_endpoint_data_db[1].to_dict()['id']}/investigations/count", headers=valid_db_credentials_header, ) diff --git a/test/db/test_entity_helper.py b/test/db/test_entity_helper.py index bba41776..121e595f 100644 --- a/test/db/test_entity_helper.py +++ b/test/db/test_entity_helper.py @@ -22,23 +22,23 @@ def dataset_entity(): def datafile_entity(dataset_entity): datafileformat = DATAFILEFORMAT() datafile = DATAFILE() - datafile.ID = 1 - datafile.LOCATION = "test location" + datafile.id = 1 + datafile.location = "test location" datafile.DATASET = dataset_entity datafile.DATAFILEFORMAT = datafileformat - datafile.NAME = "test name" - datafile.MOD_TIME = Constants.TEST_MOD_CREATE_DATETIME - datafile.CREATE_TIME = Constants.TEST_MOD_CREATE_DATETIME - datafile.CHECKSUM = "test checksum" - datafile.FILESIZE = 64 - datafile.DATAFILEMODTIME = Constants.TEST_MOD_CREATE_DATETIME - datafile.DATAFILECREATETIME = Constants.TEST_MOD_CREATE_DATETIME - datafile.DATASET_ID = 1 - datafile.DOI = "test doi" - datafile.DESCRIPTION = "test description" - datafile.CREATE_ID = "test create id" - datafile.MOD_ID = "test mod id" - datafile.DATAFILEFORMAT_ID = 1 + datafile.name = "test name" + datafile.modTime = Constants.TEST_MOD_CREATE_DATETIME + datafile.createTime = Constants.TEST_MOD_CREATE_DATETIME + datafile.checksum = "test checksum" + datafile.fileSize = 64 + datafile.datafileModTime = Constants.TEST_MOD_CREATE_DATETIME + datafile.datafileCreateTime = Constants.TEST_MOD_CREATE_DATETIME + datafile.dataset = 1 + datafile.doi = "test doi" + datafile.description = "test description" + datafile.createId = "test create id" + datafile.modId = "test mod id" + datafile.datafileFormat = 1 return datafile @@ -46,21 +46,21 @@ def datafile_entity(dataset_entity): class TestEntityHelper: def test_valid_to_dict(self, datafile_entity): expected_dict = { - "ID": 1, - "LOCATION": "test location", - "NAME": "test name", - "MOD_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "CHECKSUM": "test checksum", - "FILESIZE": 64, - "DATAFILEMODTIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATAFILECREATETIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATASET_ID": 1, - "DOI": "test doi", - "DESCRIPTION": "test description", - "CREATE_ID": "test create id", - "MOD_ID": "test mod id", - "DATAFILEFORMAT_ID": 1, - "CREATE_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), + "id": 1, + "location": "test location", + "name": "test name", + "modTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "checksum": "test checksum", + "fileSize": 64, + "datafileModTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "datafileCreateTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "dataset1": 1, + "doi": "test doi", + "description": "test description", + "createId": "test create id", + "modId": "test mod id", + "datafileFormat1": 1, + "createTime": str(Constants.TEST_MOD_CREATE_DATETIME), } test_data = datafile_entity.to_dict() @@ -72,37 +72,37 @@ def test_valid_to_dict(self, datafile_entity): [ pytest.param( { - "ID": 1, - "LOCATION": "test location", - "NAME": "test name", - "MOD_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "CHECKSUM": "test checksum", - "FILESIZE": 64, - "DATAFILEMODTIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATAFILECREATETIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATASET_ID": 1, - "DOI": "test doi", - "DESCRIPTION": "test description", - "CREATE_ID": "test create id", - "MOD_ID": "test mod id", - "DATAFILEFORMAT_ID": 1, - "CREATE_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), + "id": 1, + "location": "test location", + "name": "test name", + "modTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "checksum": "test checksum", + "fileSize": 64, + "datafileModTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "datafileCreateTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "dataset": 1, + "doi": "test doi", + "description": "test description", + "createId": "test create id", + "modId": "test mod id", + "datafileFormat": 1, + "createTime": str(Constants.TEST_MOD_CREATE_DATETIME), "DATASET": { - "ID": None, - "CREATE_TIME": None, - "MOD_TIME": None, - "CREATE_ID": None, - "MOD_ID": None, - "INVESTIGATION_ID": None, - "COMPLETE": None, - "DESCRIPTION": None, - "DOI": None, - "END_DATE": None, - "LOCATION": None, - "NAME": None, - "STARTDATE": None, - "SAMPLE_ID": None, - "TYPE_ID": None, + "id": None, + "createTime": None, + "modTime": None, + "createId": None, + "modId": None, + "investigation": None, + "complete": None, + "description": None, + "doi": None, + "endDate": None, + "location": None, + "name": None, + "startDate": None, + "sample": None, + "type": None, }, }, "DATASET", @@ -110,53 +110,53 @@ def test_valid_to_dict(self, datafile_entity): ), pytest.param( { - "ID": 1, - "LOCATION": "test location", - "NAME": "test name", - "MOD_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "CHECKSUM": "test checksum", - "FILESIZE": 64, - "DATAFILEMODTIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATAFILECREATETIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATASET_ID": 1, - "DOI": "test doi", - "DESCRIPTION": "test description", - "CREATE_ID": "test create id", - "MOD_ID": "test mod id", - "DATAFILEFORMAT_ID": 1, - "CREATE_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), + "id": 1, + "location": "test location", + "name": "test name", + "modTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "checksum": "test checksum", + "fileSize": 64, + "datafileModTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "datafileCreateTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "dataset": 1, + "doi": "test doi", + "description": "test description", + "createId": "test create id", + "modId": "test mod id", + "datafileFormat": 1, + "createTime": str(Constants.TEST_MOD_CREATE_DATETIME), "DATASET": { - "ID": None, - "CREATE_TIME": None, - "MOD_TIME": None, - "CREATE_ID": None, - "MOD_ID": None, - "INVESTIGATION_ID": None, - "COMPLETE": None, - "DESCRIPTION": None, - "DOI": None, - "END_DATE": None, - "LOCATION": None, - "NAME": None, - "STARTDATE": None, - "SAMPLE_ID": None, - "TYPE_ID": None, + "id": None, + "createTime": None, + "modTime": None, + "createId": None, + "modId": None, + "investigation": None, + "complete": None, + "description": None, + "doi": None, + "endDate": None, + "location": None, + "name": None, + "startDate": None, + "sample": None, + "type": None, "INVESTIGATION": { - "ID": None, - "CREATE_ID": None, - "CREATE_TIME": None, - "DOI": None, - "ENDDATE": None, - "MOD_ID": None, - "MOD_TIME": None, - "NAME": None, - "RELEASEDATE": None, - "STARTDATE": None, - "SUMMARY": None, - "TITLE": None, - "VISIT_ID": None, - "FACILITY_ID": None, - "TYPE_ID": None, + "id": None, + "createId": None, + "createTime": None, + "doi": None, + "endDate": None, + "modId": None, + "modTime": None, + "name": None, + "releaseDate": None, + "startDate": None, + "summary": None, + "title": None, + "visitId": None, + "facility": None, + "type": None, }, }, }, @@ -176,21 +176,21 @@ def test_valid_get_related_entity(self, dataset_entity, datafile_entity): def test_valid_update_from_dict(self, datafile_entity): datafile = DATAFILE() test_dict_data = { - "ID": 1, - "LOCATION": "test location", - "NAME": "test name", - "MOD_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "CHECKSUM": "test checksum", - "FILESIZE": 64, - "DATAFILEMODTIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATAFILECREATETIME": str(Constants.TEST_MOD_CREATE_DATETIME), - "DATASET_ID": 1, - "DOI": "test doi", - "DESCRIPTION": "test description", - "CREATE_ID": "test create id", - "MOD_ID": "test mod id", - "DATAFILEFORMAT_ID": 1, - "CREATE_TIME": str(Constants.TEST_MOD_CREATE_DATETIME), + "id": 1, + "location": "test location", + "name": "test name", + "modTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "checksum": "test checksum", + "fileSize": 64, + "datafileModTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "datafileCreateTime": str(Constants.TEST_MOD_CREATE_DATETIME), + "dataset": 1, + "doi": "test doi", + "description": "test description", + "createId": "test create id", + "modId": "test mod id", + "datefileFormat": 1, + "createTime": str(Constants.TEST_MOD_CREATE_DATETIME), } datafile.update_from_dict(test_dict_data) diff --git a/test/db/test_query_filter_factory.py b/test/db/test_query_filter_factory.py index a3a35063..16e3394b 100644 --- a/test/db/test_query_filter_factory.py +++ b/test/db/test_query_filter_factory.py @@ -45,7 +45,7 @@ def test_valid_limit_filter(self): @pytest.mark.usefixtures("flask_test_app_db") def test_valid_order_filter(self): assert isinstance( - QueryFilterFactory.get_query_filter({"order": "ID DESC"}), + QueryFilterFactory.get_query_filter({"order": "id DESC"}), DatabaseOrderFilter, ) @@ -59,14 +59,14 @@ def test_valid_skip_filter(self): @pytest.mark.parametrize( "filter_input", [ - pytest.param({"where": {"ID": {"eq": "1"}}}, id="eq operator"), - pytest.param({"where": {"ID": {"gt": "1"}}}, id="gt operator"), - pytest.param({"where": {"ID": {"gte": "1"}}}, id="gte operator"), - pytest.param({"where": {"ID": {"in": ["1", "2", "3"]}}}, id="in operator"), - pytest.param({"where": {"ID": {"like": "3"}}}, id="like operator"), - pytest.param({"where": {"ID": {"nlike": "3"}}}, id="not like operator"), - pytest.param({"where": {"ID": {"lt": "1"}}}, id="lt operator"), - pytest.param({"where": {"ID": {"lte": "1"}}}, id="lte operator"), + pytest.param({"where": {"id": {"eq": "1"}}}, id="eq operator"), + pytest.param({"where": {"id": {"gt": "1"}}}, id="gt operator"), + pytest.param({"where": {"id": {"gte": "1"}}}, id="gte operator"), + pytest.param({"where": {"id": {"in": ["1", "2", "3"]}}}, id="in operator"), + pytest.param({"where": {"id": {"like": "3"}}}, id="like operator"), + pytest.param({"where": {"id": {"nlike": "3"}}}, id="not like operator"), + pytest.param({"where": {"id": {"lt": "1"}}}, id="lt operator"), + pytest.param({"where": {"id": {"lte": "1"}}}, id="lte operator"), ], ) def test_valid_where_filter(self, filter_input): diff --git a/test/test_get_filters_from_query.py b/test/test_get_filters_from_query.py index 2a0a3a48..80dd2608 100644 --- a/test/test_get_filters_from_query.py +++ b/test/test_get_filters_from_query.py @@ -29,13 +29,13 @@ def test_invalid_filter(self, flask_test_app_db): "filter_input, filter_type", [ pytest.param( - 'distinct="ID"', DatabaseDistinctFieldFilter, id="DB distinct filter", + 'distinct="id"', DatabaseDistinctFieldFilter, id="DB distinct filter", ), pytest.param( 'include="TEST"', DatabaseIncludeFilter, id="DB include filter", ), pytest.param("limit=10", DatabaseLimitFilter, id="DB limit filter"), - pytest.param('order="ID DESC"', DatabaseOrderFilter, id="DB order filter"), + pytest.param('order="id DESC"', DatabaseOrderFilter, id="DB order filter"), pytest.param("skip=10", DatabaseSkipFilter, id="DB skip filter"), ], )