-
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.
* add extra step to deal with migration from local-authority-eng to local-authoriity * update key to match if statement * move to integration tests as they are using the file system and add test or -eng removal
- Loading branch information
1 parent
a48cf31
commit 5416de4
Showing
3 changed files
with
82 additions
and
50 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,75 @@ | ||
from digital_land.organisation import Organisation | ||
import csv | ||
import logging | ||
|
||
|
||
class TestOrganisation: | ||
def test_organisation_lookup(self): | ||
organisation = Organisation( | ||
organisation_path="tests/data/listed-building/organisation.csv" | ||
) | ||
|
||
assert organisation.lookup("Borchester") == "" | ||
assert ( | ||
organisation.lookup("local-authority-eng:LBH") == "local-authority-eng:LBH" | ||
) | ||
assert ( | ||
organisation.lookup("government-organisation:PB1164") | ||
== "government-organisation:PB1164" | ||
) | ||
assert ( | ||
organisation.lookup( | ||
"http://opendatacommunities.org/id/district-council/brentwood" | ||
) | ||
== "local-authority-eng:BRW" | ||
) | ||
|
||
assert ( | ||
organisation.lookup( | ||
"http://opendatacommunities.org/id/district-council/tamworth" | ||
) | ||
== "local-authority-eng:TAW" | ||
) | ||
assert ( | ||
organisation.lookup( | ||
"http://opendatacommunities.org/doc/district-council/tamworth" | ||
) | ||
== "local-authority-eng:TAW" | ||
) | ||
assert ( | ||
organisation.lookup( | ||
"https://opendatacommunities.org/id/district-council/tamworth" | ||
) | ||
== "local-authority-eng:TAW" | ||
) | ||
assert ( | ||
organisation.lookup( | ||
"https://opendatacommunities.org/doc/district-council/tamworth" | ||
) | ||
== "local-authority-eng:TAW" | ||
) | ||
|
||
assert organisation.lookup("E07000068") == "local-authority-eng:BRW" | ||
assert organisation.lookup("Lambeth") == "local-authority-eng:LBH" | ||
|
||
def test_organisation_lookup_eng_removed(self, tmp_path): | ||
org_match = { | ||
"organisation": "development-corporation:Q20648596", | ||
"entity": 1, | ||
"wikidata": "Q20648596", | ||
"name": "Example", | ||
"statistical-geography": "E000001", | ||
"opendatacommunities": "http://opendatacommunities.org/id/dev-corp/old-oak-and-park-royal", | ||
} | ||
logging.warning(type(org_match)) | ||
with open(tmp_path / "test.csv", "w") as f: | ||
dictwriter = csv.DictWriter(f, fieldnames=org_match.keys()) | ||
dictwriter.writeheader() | ||
logging.warning(type(org_match)) | ||
dictwriter.writerow(org_match) | ||
organisation = Organisation( | ||
organisation_path="tests/data/listed-building/organisation.csv" | ||
) | ||
assert ( | ||
organisation.lookup("local-authority-eng:BRW") == "local-authority-eng:BRW" | ||
) |
This file was deleted.
Oops, something went wrong.