[tests] fix location tests
a previous commit that switched the primary and secondary location provider broke the unit tests - fix that.
This commit is contained in:
parent
fc8783ee13
commit
81c5e75624
1 changed files with 4 additions and 4 deletions
|
@ -11,7 +11,7 @@ def urllib_req(mocker):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def primaryLocation():
|
def secondaryLocation():
|
||||||
return {
|
return {
|
||||||
"country": "Middle Earth",
|
"country": "Middle Earth",
|
||||||
"longitude": "10.0",
|
"longitude": "10.0",
|
||||||
|
@ -21,7 +21,7 @@ def primaryLocation():
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def secondaryLocation():
|
def primaryLocation():
|
||||||
return {
|
return {
|
||||||
"country_name": "Rivia",
|
"country_name": "Rivia",
|
||||||
"longitude": "-10.0",
|
"longitude": "-10.0",
|
||||||
|
@ -33,7 +33,7 @@ def secondaryLocation():
|
||||||
def test_primary_provider(urllib_req, primaryLocation):
|
def test_primary_provider(urllib_req, primaryLocation):
|
||||||
urllib_req.urlopen.return_value.read.return_value = json.dumps(primaryLocation)
|
urllib_req.urlopen.return_value.read.return_value = json.dumps(primaryLocation)
|
||||||
|
|
||||||
assert util.location.country() == primaryLocation["country"]
|
assert util.location.country() == primaryLocation["country_name"]
|
||||||
assert util.location.coordinates() == (
|
assert util.location.coordinates() == (
|
||||||
primaryLocation["latitude"],
|
primaryLocation["latitude"],
|
||||||
primaryLocation["longitude"],
|
primaryLocation["longitude"],
|
||||||
|
@ -46,7 +46,7 @@ def test_secondary_provider(mocker, urllib_req, secondaryLocation):
|
||||||
urlopen.read.return_value = json.dumps(secondaryLocation)
|
urlopen.read.return_value = json.dumps(secondaryLocation)
|
||||||
urllib_req.urlopen.side_effect = [RuntimeError(), urlopen]
|
urllib_req.urlopen.side_effect = [RuntimeError(), urlopen]
|
||||||
|
|
||||||
assert util.location.country() == secondaryLocation["country_name"]
|
assert util.location.country() == secondaryLocation["country"]
|
||||||
assert util.location.coordinates() == (
|
assert util.location.coordinates() == (
|
||||||
secondaryLocation["latitude"],
|
secondaryLocation["latitude"],
|
||||||
secondaryLocation["longitude"],
|
secondaryLocation["longitude"],
|
||||||
|
|
Loading…
Reference in a new issue