@@ -70,12 +70,12 @@ def test_cli_data_limite_none(api):
7070 assert len (responses .calls ) == 2
7171 if six .PY3 :
7272 assert responses .calls [0 ].request .url == 'http://localhost/meta/result_count.json?planet=Saturn'
73- assert responses .calls [1 ].request .url == 'http://localhost/data.json?planet=Saturn&limit=1591 '
73+ assert responses .calls [1 ].request .url == 'http://localhost/data.json?planet=Saturn&limit=1636 '
7474 else :
75- assert 'limit=1591 ' in responses .calls [1 ].request .url
75+ assert 'limit=1636 ' in responses .calls [1 ].request .url
7676
7777 assert responses .calls [1 ].response .text == json
78- assert len (resp ) == 1591
78+ assert len (resp ) == 1636
7979
8080
8181@responses .activate
@@ -89,60 +89,60 @@ def test_data_argv_none(api):
8989
9090@responses .activate
9191def test_cli_metadata (api ):
92- json = open ('tests/api/metadata/S_IMG_CO_ISS_1459551972_N .json' , 'r' ).read ()
92+ json = open ('tests/api/metadata_v2/COISS_2001-1459551663_1459568594-N1459551972_1 .json' , 'r' ).read ()
9393 responses .add (responses .GET ,
94- 'http://localhost/metadata/S_IMG_CO_ISS_1459551972_N .json' ,
94+ 'http://localhost/metadata_v2/COISS_2001-1459551663_1459568594-N1459551972_1 .json' ,
9595 body = json )
9696
97- argv = 'S_IMG_CO_ISS_1459551972_N ' .split ()
97+ argv = 'COISS_2001-1459551663_1459568594-N1459551972_1 ' .split ()
9898 resp = cli .metadata (argv , api = api )
9999
100100 assert len (responses .calls ) == 1
101- assert responses .calls [0 ].request .url == 'http://localhost/metadata/S_IMG_CO_ISS_1459551972_N .json'
101+ assert responses .calls [0 ].request .url == 'http://localhost/metadata_v2/COISS_2001-1459551663_1459568594-N1459551972_1 .json'
102102 assert responses .calls [0 ].response .text == json
103103
104- assert resp .ring_obs_id == 'S_IMG_CO_ISS_1459551972_N '
104+ assert resp .opus_id == 'COISS_2001-1459551663_1459568594-N1459551972_1 '
105105
106106
107107@responses .activate
108108def test_cli_image (api ):
109- img = open ('tests/api/image/med/S_IMG_CO_ISS_1459551972_N .json' , 'r' ).read ()
109+ img = open ('tests/api/image/med/COISS_2001-1459551663_1459568594-N1459551972_1 .json' , 'r' ).read ()
110110 responses .add (responses .GET ,
111- 'http://localhost/image/med/S_IMG_CO_ISS_1459551972_N .json' ,
111+ 'http://localhost/image/med/COISS_2001-1459551663_1459568594-N1459551972_1 .json' ,
112112 body = img )
113113
114- argv = 'S_IMG_CO_ISS_1459551972_N --size med' .split ()
114+ argv = 'COISS_2001-1459551663_1459568594-N1459551972_1 --size med' .split ()
115115 resp = cli .image (argv , api = api )
116116
117117 assert len (responses .calls ) == 1
118- assert responses .calls [0 ].request .url == 'http://localhost/image/med/S_IMG_CO_ISS_1459551972_N .json'
118+ assert responses .calls [0 ].request .url == 'http://localhost/image/med/COISS_2001-1459551663_1459568594-N1459551972_1 .json'
119119 assert responses .calls [0 ].response .text == img
120120
121121 assert resp == 'https://pds-rings.seti.org/holdings/previews/COISS_2xxx/COISS_2001/data/1459551663_1459568594/N1459551972_1_med.jpg'
122122
123123
124124@responses .activate
125125def test_cli_image_download (api ):
126- img = open ('tests/api/image/med/S_IMG_CO_ISS_1459551972_N .json' , 'r' ).read ()
126+ img = open ('tests/api/image/med/COISS_2001-1459551663_1459568594-N1459551972_1 .json' , 'r' ).read ()
127127 responses .add (responses .GET ,
128- 'http://localhost/image/med/S_IMG_CO_ISS_1459551972_N .json' ,
128+ 'http://localhost/image/med/COISS_2001-1459551663_1459568594-N1459551972_1 .json' ,
129129 body = img )
130130
131131 fname = 'N1459551972_1_med.jpg'
132132 jpg = 'https://pds-rings.seti.org/holdings/previews/COISS_2xxx/COISS_2001/data/1459551663_1459568594/N1459551972_1_med.jpg'
133133
134- with open ('tests/api/image/med /' + fname , 'rb' ) as img :
134+ with open ('tests/data /' + fname , 'rb' ) as img :
135135 responses .add (responses .GET , jpg ,
136136 body = img .read (), status = 200 ,
137137 content_type = 'image/jpeg' ,
138138 stream = True
139139 )
140140
141- argv = 'S_IMG_CO_ISS_1459551972_N --output tests/test.jpg' .split ()
141+ argv = 'COISS_2001-1459551663_1459568594-N1459551972_1 --output tests/test.jpg' .split ()
142142 resp = cli .image (argv , api = api )
143143
144144 assert len (responses .calls ) == 2
145- assert responses .calls [0 ].request .url == 'http://localhost/image/med/S_IMG_CO_ISS_1459551972_N .json'
145+ assert responses .calls [0 ].request .url == 'http://localhost/image/med/COISS_2001-1459551663_1459568594-N1459551972_1 .json'
146146 assert responses .calls [1 ].request .url == jpg
147147
148148 assert resp == 'tests/test.jpg'
@@ -152,27 +152,27 @@ def test_cli_image_download(api):
152152
153153@responses .activate
154154def test_cli_files (api ):
155- json = open ('tests/api/files/S_IMG_CO_ISS_1459551972_N .json' , 'r' ).read ()
155+ json = open ('tests/api/files/COISS_2001-1459551663_1459568594-N1459551972_1 .json' , 'r' ).read ()
156156 responses .add (responses .GET ,
157- 'http://localhost/files/S_IMG_CO_ISS_1459551972_N .json' ,
157+ 'http://localhost/files/COISS_2001-1459551663_1459568594-N1459551972_1 .json' ,
158158 body = json )
159159
160- argv = 'S_IMG_CO_ISS_1459551972_N ' .split ()
160+ argv = 'COISS_2001-1459551663_1459568594-N1459551972_1 ' .split ()
161161 resp = cli .files (argv , api = api )
162162
163163 assert len (responses .calls ) == 1
164- assert responses .calls [0 ].request .url == 'http://localhost/files/S_IMG_CO_ISS_1459551972_N .json'
164+ assert responses .calls [0 ].request .url == 'http://localhost/files/COISS_2001-1459551663_1459568594-N1459551972_1 .json'
165165 assert responses .calls [0 ].response .text == json
166166
167- assert 'OPUS API Files for observation: S_IMG_CO_ISS_1459551972_N ' in resp
167+ assert 'OPUS API Files for observation: COISS_2001-1459551663_1459568594-N1459551972_1 ' in resp
168168 assert 'LBL: https://pds-rings.seti.org/holdings/calibrated/COISS_2xxx/COISS_2001/data/1459551663_1459568594/N1459551972_1_CALIB.LBL' in resp
169169
170170
171171@responses .activate
172172def test_cli_files_downlad (api ):
173- json = open ('tests/api/files/S_IMG_CO_ISS_1459551972_N .json' , 'r' ).read ()
173+ json = open ('tests/api/files/COISS_2001-1459551663_1459568594-N1459551972_1 .json' , 'r' ).read ()
174174 responses .add (responses .GET ,
175- 'http://localhost/files/S_IMG_CO_ISS_1459551972_N .json' ,
175+ 'http://localhost/files/COISS_2001-1459551663_1459568594-N1459551972_1 .json' ,
176176 body = json )
177177
178178 fname = 'N1459551972_1.LBL'
@@ -185,11 +185,11 @@ def test_cli_files_downlad(api):
185185 stream = True
186186 )
187187
188- argv = 'S_IMG_CO_ISS_1459551972_N -f RAW_IMAGE LBL --output tests/test.lbl' .split ()
188+ argv = 'COISS_2001-1459551663_1459568594-N1459551972_1 -f RAW_DATA LBL --output tests/test.lbl' .split ()
189189 resp = cli .files (argv , api = api )
190190
191191 assert len (responses .calls ) == 2
192- assert responses .calls [0 ].request .url == 'http://localhost/files/S_IMG_CO_ISS_1459551972_N .json'
192+ assert responses .calls [0 ].request .url == 'http://localhost/files/COISS_2001-1459551663_1459568594-N1459551972_1 .json'
193193 assert responses .calls [1 ].request .url == lbl
194194
195195 assert resp == 'tests/test.lbl'
@@ -229,32 +229,8 @@ def test_cli_field_all(api):
229229 assert responses .calls [0 ].response .text == json
230230
231231 r = repr (resp )
232- assert 'OPUS API list of all fields available (304):' in r
233- assert 'GLOBAL' in r
234- assert 'TITAN' in r
235-
236- @responses .activate
237- def test_cli_field_group (api ):
238- json = open ('tests/api/fields.json' , 'r' ).read ()
239- responses .add (responses .GET ,
240- 'http://localhost/fields/TITAN.json' ,
241- body = '{}' )
242- responses .add (responses .GET ,
243- 'http://localhost/fields.json' ,
244- body = json )
245-
246- argv = 'TITAN' .split ()
247- resp = cli .field (argv , api = api )
248-
249- assert len (responses .calls ) == 2
250- assert responses .calls [0 ].request .url == 'http://localhost/fields/TITAN.json'
251- assert responses .calls [0 ].response .text == '{}'
252- assert responses .calls [1 ].request .url == 'http://localhost/fields.json'
253- assert responses .calls [1 ].response .text == json
254-
255- r = repr (resp )
256- assert 'OPUS API Surface Geometry fields (31) for `Titan`:' in r
257- assert 'Sub-Solar IAU West Longitude (subsolarIAUlongitude)' in r
232+ assert 'OPUS API list of all fields available (247):' in r
233+ assert 'planet' in r
258234
259235@responses .activate
260236def test_cli_field_err (api ):
@@ -269,10 +245,8 @@ def test_cli_field_err(api):
269245 argv = 'abc' .split ()
270246 resp = cli .field (argv , api = api )
271247
272- assert len (responses .calls ) == 2
248+ assert len (responses .calls ) == 1
273249 assert responses .calls [0 ].request .url == 'http://localhost/fields/abc.json'
274250 assert responses .calls [0 ].response .text == '{}'
275- assert responses .calls [1 ].request .url == 'http://localhost/fields.json'
276- assert responses .calls [1 ].response .text == json
277251
278252 assert resp == 'Unknown field. To list all the available fields, run: `opus-field --all`'
0 commit comments