-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from digital_land.phase.prune import EntityPrunePhase | ||
from digital_land.log import IssueLog | ||
from digital_land.log import DatasetResourceLog | ||
|
||
|
||
class TestEntityPrunePhase: | ||
def test_process_returns_missing_reference(self): | ||
input_stream = [ | ||
{ | ||
"row": { | ||
"prefix": "ancient-woodland", | ||
"reference": "", | ||
"entity": "", | ||
}, | ||
"entry-number": 1, | ||
"resource": "123", | ||
"line-number": 2, | ||
} | ||
] | ||
issues = IssueLog() | ||
resource_log = DatasetResourceLog() | ||
phase = EntityPrunePhase(issues, resource_log) | ||
|
||
list(phase.process(input_stream)) | ||
assert issues.rows[0]["issue-type"] == "unknown entity - missing reference" | ||
|
||
def test_process_returns_unknown_entity(self): | ||
input_stream = [ | ||
{ | ||
"row": { | ||
"prefix": "dataset", | ||
"reference": "REF01", | ||
"entity": "", | ||
}, | ||
"entry-number": 1, | ||
"resource": "123", | ||
"line-number": 2, | ||
} | ||
] | ||
issues = IssueLog() | ||
resource_log = DatasetResourceLog() | ||
phase = EntityPrunePhase(issues, resource_log) | ||
|
||
list(phase.process(input_stream)) | ||
assert issues.rows[0]["issue-type"] == "unknown entity" |