This is an automated email from the ASF dual-hosted git repository.
fgreg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git
The following commit(s) were added to refs/heads/master by this push:
new 225f70e Made use of session object optional. (#20)
225f70e is described below
commit 225f70e289fd3f9d989a6523ab159a40ee4d4d5a
Author: fgreg <[email protected]>
AuthorDate: Wed Jul 11 10:08:06 2018 -0700
Made use of session object optional. (#20)
---
client/nexuscli/nexuscli.py | 6 +++++-
client/nexuscli/test/nexuscli_test.py | 9 +++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/client/nexuscli/nexuscli.py b/client/nexuscli/nexuscli.py
index b542dba..1fe024f 100644
--- a/client/nexuscli/nexuscli.py
+++ b/client/nexuscli/nexuscli.py
@@ -59,7 +59,7 @@ target = 'http://localhost:8083'
session = requests.session()
-def set_target(url):
+def set_target(url, use_session=True):
"""
Set the URL for the NEXUS webapp endpoint.
@@ -69,6 +69,10 @@ def set_target(url):
global target
target = url
+ if not use_session:
+ global session
+ session = requests
+
def dataset_list():
"""
diff --git a/client/nexuscli/test/nexuscli_test.py
b/client/nexuscli/test/nexuscli_test.py
index 61a7e46..ec5c12e 100644
--- a/client/nexuscli/test/nexuscli_test.py
+++ b/client/nexuscli/test/nexuscli_test.py
@@ -22,6 +22,11 @@ import nexuscli
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))
@@ -42,10 +47,10 @@ class TestCli(unittest.TestCase):
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)