Skip to content

Commit

Permalink
Merge pull request #401 from ral-facilities/feature/icat-backend-gene…
Browse files Browse the repository at this point in the history
…rator#369

Feature/icat backend generator#369
  • Loading branch information
Reillyhewitson authored Feb 17, 2023
2 parents b08022a + ae6ae0b commit 31aad3e
Show file tree
Hide file tree
Showing 12 changed files with 1,063 additions and 2,082 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ jobs:

- name: Add dummy data to icatdb
run: poetry run python -m util.icat_db_generator
- name: Get SQL dump of dummy data
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of dummy data to be prepared
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_1.sql

# Drop and re-create icatdb to remove generated data
Expand All @@ -307,6 +309,8 @@ jobs:
- name: Add (new) dummy data to icatdb
run: |
cd /home/runner/work/datagateway-api/datagateway-api; poetry run python -m util.icat_db_generator
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of new dummy data
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_2.sql

Expand Down Expand Up @@ -344,6 +348,8 @@ jobs:

- name: Add dummy data to icatdb
run: poetry run python -m util.icat_db_generator
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of dummy data from main's generator script
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_main.sql

Expand Down
25 changes: 13 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_valid_get_facility_cycles_with_filters(
headers=valid_db_credentials_header,
)

assert test_response.json == [isis_specific_endpoint_data_db[1].to_dict()]
assert test_response.json[0] == isis_specific_endpoint_data_db[1].to_dict()

def test_invalid_get_facility_cycles_with_filters(
self, flask_test_app_db, valid_db_credentials_header, final_instrument_id,
Expand Down
145 changes: 69 additions & 76 deletions test/integration/datagateway_api/db/test_database_filter_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,21 @@ def test_invalid_get_field(self, flask_test_app_db):
"ne",
"Title for DataGateway API Testing (DB) 0",
{
"doi": "0-449-78690-0",
"doi": "0-417-77631-4",
"endDate": "2000-07-09 00:00:00",
"name": "INVESTIGATION 1",
"releaseDate": "2000-07-05 00:00:00",
"startDate": "2000-04-03 00:00:00",
"summary": "Season identify professor happen third."
" Beat professional blue clear style have. "
"Light final summer.",
"title": "Including spend increase ability music"
" skill former. Agreement director concern once "
"technology sometimes someone staff."
"\nSuccess pull bar. Laugh senior example.",
"summary": "Throw hope parent. Receive entire soon."
" War top air agent must voice high describe.\nMonth "
"shake voice. Do discuss despite least face again study."
" Two beyond picture rich fast sea time.",
"title": "Analysis reflect work or hour color maybe."
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 2,
"fileSize": None,
"fileCount": None,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
},
id="not equal (ne)",
),
Expand All @@ -201,116 +200,110 @@ def test_invalid_get_field(self, flask_test_app_db):
"nlike",
"Title for DataGateway API Testing (DB) 0",
{
"doi": "0-449-78690-0",
"doi": "0-417-77631-4",
"endDate": "2000-07-09 00:00:00",
"name": "INVESTIGATION 1",
"releaseDate": "2000-07-05 00:00:00",
"startDate": "2000-04-03 00:00:00",
"summary": "Season identify professor happen third."
" Beat professional blue clear style have. "
"Light final summer.",
"title": "Including spend increase ability music"
" skill former. Agreement director concern once "
"technology sometimes someone staff."
"\nSuccess pull bar. Laugh senior example.",
"summary": "Throw hope parent. Receive entire soon. "
"War top air agent must voice high describe.\nMonth "
"shake voice. Do discuss despite least face again study. "
"Two beyond picture rich fast sea time.",
"title": "Analysis reflect work or hour color maybe."
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 2,
"fileSize": None,
"fileCount": None,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
},
id="not like",
),
pytest.param(
"lt",
"Title for DataGateway API Testing (DB) 0",
{
"doi": "0-449-78690-0",
"doi": "0-417-77631-4",
"endDate": "2000-07-09 00:00:00",
"name": "INVESTIGATION 1",
"releaseDate": "2000-07-05 00:00:00",
"startDate": "2000-04-03 00:00:00",
"summary": "Season identify professor happen third."
" Beat professional blue clear style have. "
"Light final summer.",
"title": "Including spend increase ability music"
" skill former. Agreement director concern once "
"technology sometimes someone staff."
"\nSuccess pull bar. Laugh senior example.",
"summary": "Throw hope parent. Receive entire soon. "
"War top air agent must voice high describe.\n"
"Month shake voice. "
"Do discuss despite least face again study. "
"Two beyond picture rich fast sea time.",
"title": "Analysis reflect work or hour color maybe."
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 2,
"fileSize": None,
"fileCount": None,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
},
id="less than",
),
pytest.param(
"lte",
"Title for DataGateway API Testing (DB) 0",
{
"doi": "0-449-78690-0",
"doi": "0-417-77631-4",
"endDate": "2000-07-09 00:00:00",
"name": "INVESTIGATION 1",
"releaseDate": "2000-07-05 00:00:00",
"startDate": "2000-04-03 00:00:00",
"summary": "Season identify professor happen third."
" Beat professional blue clear style have. "
"Light final summer.",
"title": "Including spend increase ability music"
" skill former. Agreement director concern once "
"technology sometimes someone staff."
"\nSuccess pull bar. Laugh senior example.",
"summary": "Throw hope parent. Receive entire soon. "
"War top air agent must voice high describe.\n"
"Month shake voice. "
"Do discuss despite least face again study. "
"Two beyond picture rich fast sea time.",
"title": "Analysis reflect work or hour color maybe."
"\nMuch team discussion message weight.",
"facilityID": 1,
"typeID": 2,
"fileSize": None,
"fileCount": None,
"typeID": 3,
"fileSize": 0,
"fileCount": 0,
},
id="less than or equal",
),
pytest.param(
"gt",
"Title for DataGateway API Testing (DB) 0",
{
"doi": "0-9634101-9-9",
"endDate": "2001-05-04 00:00:00",
"name": "INVESTIGATION 4",
"releaseDate": "2001-09-26 00:00:00",
"startDate": "2001-02-02 00:00:00",
"summary": "Fast purpose right power away health south."
"\nQuality serve food buy responsibility go much."
" Situation raise manage positive help daughter."
" Yes player reveal.",
"title": "Would easy whom fact again return choose."
" Site suffer should spring painting glass."
"\nThem name charge strategy machine level."
" Establish better opportunity.",
"doi": "0-9996467-0-2",
"endDate": "2007-07-09 00:00:00",
"name": "INVESTIGATION 29",
"releaseDate": "2007-07-05 00:00:00",
"startDate": "2007-04-03 00:00:00",
"summary": "City plant especially ever eight. Wife street"
" under. Life character drive down. Bag sport benefit also"
" price.\nIncrease spring box successful travel.",
"title": "Usually water six learn bring white development "
"political. Meeting those voice hand.",
"facilityID": 1,
"typeID": 3,
"fileSize": None,
"fileCount": None,
"typeID": 1,
"fileSize": 0,
"fileCount": 0,
},
id="greater than",
),
pytest.param(
"gte",
"Title for DataGateway API Testing (DB) 0",
{
"doi": "0-9634101-9-9",
"endDate": "2001-05-04 00:00:00",
"name": "INVESTIGATION 4",
"releaseDate": "2001-09-26 00:00:00",
"startDate": "2001-02-02 00:00:00",
"summary": "Fast purpose right power away health south."
"\nQuality serve food buy responsibility go much."
" Situation raise manage positive help daughter."
" Yes player reveal.",
"title": "Would easy whom fact again return choose."
" Site suffer should spring painting glass."
"\nThem name charge strategy machine level."
" Establish better opportunity.",
"doi": "0-9996467-0-2",
"endDate": "2007-07-09 00:00:00",
"name": "INVESTIGATION 29",
"releaseDate": "2007-07-05 00:00:00",
"startDate": "2007-04-03 00:00:00",
"summary": "City plant especially ever eight. "
"Wife street under. Life character drive down. Bag sport"
" benefit also price.\nIncrease spring box successful"
" travel.",
"title": "Usually water six learn bring white development "
"political. Meeting those voice hand.",
"facilityID": 1,
"typeID": 3,
"fileSize": None,
"fileCount": None,
"typeID": 1,
"fileSize": 0,
"fileCount": 0,
},
id="greater than or equal",
),
Expand Down
Loading

0 comments on commit 31aad3e

Please sign in to comment.