Skip to content

Commit

Permalink
Add unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Wu committed Dec 18, 2024
1 parent 9201018 commit c62bc1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ecoscope/io/earthranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,10 +1040,11 @@ def post_source(
response = self._post("sources", payload=payload)
return pd.DataFrame([response])

def post_source_provider(
def post_sourceproviders(
self,
provider_key: str,
display_name: str,
additional: typing.Dict = {},
**kwargs,
) -> pd.DataFrame:
"""
Expand All @@ -1060,6 +1061,7 @@ def post_source_provider(
payload = {
"provider_key": provider_key,
"display_name": display_name,
"additional": additional,
}

if kwargs:
Expand Down
10 changes: 8 additions & 2 deletions tests/test_earthranger_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import pandas as pd
import pytest
import pytz
from erclient import ERClientException
from shapely.geometry import Point

import ecoscope
from erclient import ERClientException

from ecoscope.io.earthranger import EarthRangerIO
from ecoscope.io.earthranger_utils import TIME_COLS

Expand Down Expand Up @@ -205,6 +204,13 @@ def test_get_patrol_events_empty(patrols_mock, er_io):
assert events.empty


def test_post_sourceproviders(er_io):
response = er_io.post_sourceproviders(provider_key="test_provider_key", display_name="Test Provider Key")
assert "id" in response
assert "provider_key" in response
assert "display_name" in response


def test_post_observations(er_io):
observations = gpd.GeoDataFrame.from_dict(
[
Expand Down

0 comments on commit c62bc1a

Please sign in to comment.