Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kharude, Sachin <sachin.kharude@here.com>
  • Loading branch information
Kharude, Sachin committed Jul 28, 2021
1 parent c01b92e commit 2264dbf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/notebooks/spaces_class_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"XYZ_TOKEN\"] = \"APt3TrqqSAaKXgzQ_D8cMwA\" # Replace your token here."
"os.environ[\"XYZ_TOKEN\"] = \"YOUR-XYZ-TOKEN\" # Replace your token here."
]
},
{
Expand Down
15 changes: 15 additions & 0 deletions tests/iml/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""Module for providing test fixtures for the IML tests."""

import os
from collections import namedtuple

import pytest

Expand Down Expand Up @@ -50,3 +51,17 @@ def env_setup_done():
]
)
return env_vars_present


def get_mock_response(status_code: int, reason: str, text: str):
"""
Return mock response.
:param status_code: An int representing status_code.
:param reason: A string to represent reason.
:param text: A string to represent text.
:return: MockResponse object.
"""
MockResponse = namedtuple("MockResponse", ["status_code", "reason", "text"])
mock_response = MockResponse(status_code, reason, text)
return mock_response
6 changes: 4 additions & 2 deletions tests/iml/test_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_statistics(read_layer):
@pytest.mark.skipif(not env_setup_done(), reason="Credentials are not setup in env.")
def test_get_feature(read_layer):
"""Test get single feature from interactive map layer."""
int_resp = read_layer.get_feature(feature_id="IND")
int_resp = read_layer.get_feature(feature_id="IND", selection=["name"])
feature = int_resp.to_geojson()
assert isinstance(feature, Feature)
assert feature["id"] == "IND"
Expand All @@ -43,7 +43,9 @@ def test_get_feature(read_layer):
def test_get_features(read_layer):
"""Test get multiple features from interactive map layer."""
feature_ids = ["IND", "DEU", "USA"]
int_resp = read_layer.get_features(feature_ids=feature_ids, force_2d=True)
int_resp = read_layer.get_features(
feature_ids=feature_ids, selection=["name"], force_2d=True
)
fc = int_resp.to_geojson()
assert isinstance(fc, FeatureCollection)
for f in fc["features"]:
Expand Down

0 comments on commit 2264dbf

Please sign in to comment.