Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDAP-121 Make use of session optional #20

Merged
merged 1 commit into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/nexuscli/nexuscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
session = requests.session()


def set_target(url):
def set_target(url, use_session=True):
"""
Set the URL for the NEXUS webapp endpoint.

Expand All @@ -69,6 +69,10 @@ def set_target(url):
global target
target = url

if not use_session:
global session
session = requests


def dataset_list():
"""
Expand Down
9 changes: 7 additions & 2 deletions client/nexuscli/test/nexuscli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@


class TestCli(unittest.TestCase):

def setUp(self):
super().setUp()
nexuscli.set_target("http://localhost:8083", use_session=False)

def test_time_series(self):
ts = nexuscli.time_series(("AVHRR_OI_L4_GHRSST_NCEI", "MEASURES_SLA_JPL_1603"), box(-150, 45, -120, 60),
datetime(2016, 1, 1), datetime(2016, 12, 31))
Expand All @@ -42,10 +47,10 @@ def test_daily_difference_average(self):

def test_data_in_bounds_with_metadata_filter(self):
subset = nexuscli.subset("MUR-JPL-L4-GLOB-v4.1", None, datetime(2018, 1, 1), datetime(2018, 1, 2),
None, ["id:60758e00-5721-3a6e-bf57-78448bb0aeeb"])
None, ["id:60758e00-5721-3a6e-bf57-78448bb0aeeb"])
print(subset)

def test_data_in_bounds_with_bounding_box(self):
subset = nexuscli.subset("MUR-JPL-L4-GLOB-v4.1", box(-150, 45, -149, 46), datetime(2018, 1, 1),
datetime(2018, 1, 1), None, None)
datetime(2018, 1, 1), None, None)
print(subset)