-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from GSA/harvest-records-compare
Get latest harvest records from db
- Loading branch information
Showing
4 changed files
with
216 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "datagov-harvesting-logic" | ||
version = "0.4.4" | ||
version = "0.4.5" | ||
description = "" | ||
# authors = [ | ||
# {name = "Jin Sun", email = "[email protected]"}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,6 @@ | |
def app() -> Flask: | ||
app = create_app() | ||
|
||
app.config["TESTING"] = True | ||
|
||
with app.app_context(): | ||
db.create_all() | ||
yield app | ||
|
@@ -73,6 +71,21 @@ def source_data_dcatus(organization_data: dict) -> dict: | |
} | ||
|
||
|
||
@pytest.fixture | ||
def source_data_dcatus_2(organization_data: dict) -> dict: | ||
return { | ||
"id": "3f2652de-91df-4c63-8b53-bfced20b276b", | ||
"name": "Test Source", | ||
"notification_emails": "[email protected]", | ||
"organization_id": organization_data["id"], | ||
"frequency": "daily", | ||
"url": f"{HARVEST_SOURCE_URL}/dcatus/dcatus_2.json", | ||
"schema_type": "type1", | ||
"source_type": "dcatus", | ||
"status": "active", | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def source_data_waf(organization_data: dict) -> dict: | ||
return { | ||
|
@@ -213,6 +226,100 @@ def interface_with_multiple_jobs( | |
return interface | ||
|
||
|
||
@pytest.fixture | ||
def latest_records(source_data_dcatus, source_data_dcatus_2): | ||
return [ | ||
{ | ||
"identifier": "a", | ||
"date_created": "2024-01-01T00:00:00.001Z", | ||
"source_raw": "data", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "a", | ||
"date_created": "2024-03-01T00:00:00.001Z", | ||
"source_raw": "data_1", | ||
"status": "success", | ||
"action": "update", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "b", | ||
"date_created": "2024-03-01T00:00:00.001Z", | ||
"source_raw": "data_10", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "b", | ||
"date_created": "2022-05-01T00:00:00.001Z", | ||
"source_raw": "data_30", | ||
"status": "error", | ||
"action": "update", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "c", | ||
"date_created": "2024-05-01T00:00:00.001Z", | ||
"source_raw": "data_12", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "d", | ||
"date_created": "2024-05-01T00:00:00.001Z", | ||
"source_raw": "data_2", | ||
"status": "success", | ||
"action": "delete", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "d", | ||
"date_created": "2024-04-01T00:00:00.001Z", | ||
"source_raw": "data_5", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "e", | ||
"date_created": "2024-04-01T00:00:00.001Z", | ||
"source_raw": "data_123", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "e", | ||
"date_created": "2024-04-02T00:00:00.001Z", | ||
"source_raw": "data_123", | ||
"status": "success", | ||
"action": "delete", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "e", | ||
"date_created": "2024-04-03T00:00:00.001Z", | ||
"source_raw": "data_123", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus["id"], | ||
}, | ||
{ | ||
"identifier": "f", | ||
"date_created": "2024-04-03T00:00:00.001Z", | ||
"source_raw": "data_123", | ||
"status": "success", | ||
"action": "create", | ||
"harvest_source_id": source_data_dcatus_2["id"], | ||
}, | ||
] | ||
|
||
|
||
@pytest.fixture | ||
def internal_compare_data(job_data_dcatus: dict) -> dict: | ||
# ruff: noqa: E501 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5e9fba7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.