@@ -250,7 +250,7 @@ def test_query_criteria():
250
250
251
251
def mock_run_query (table = "ps" , select = 'pl_name,discoverymethod,dec' , where = "discoverymethod like 'Microlensing' and dec > 0" ):
252
252
assert table == "ps"
253
- assert select == ' pl_name,discoverymethod,dec'
253
+ assert select == " pl_name,discoverymethod,dec"
254
254
assert where == "discoverymethod like 'Microlensing' and dec > 0"
255
255
result = PropertyMock ()
256
256
result = {'pl_name' : 'TCP J05074264+2447555 b' , 'discoverymethod' : 'Microlensing' , 'dec' : [24.7987499 ] * u .deg }
@@ -260,3 +260,25 @@ def mock_run_query(table="ps", select='pl_name,discoverymethod,dec', where="disc
260
260
assert 'TCP J05074264+2447555 b' in response ['pl_name' ]
261
261
assert 'Microlensing' in response ['discoverymethod' ]
262
262
assert response ['dec' ] == [24.7987499 ] * u .deg
263
+
264
+
265
+ @patch ('astroquery.nasa_exoplanet_archive.core.get_access_url' ,
266
+ Mock (side_effect = lambda x : 'https://some.url' ))
267
+ @pytest .mark .skipif (not pyvo_OK , reason = 'not pyvo_OK' )
268
+ def test_get_query_payload ():
269
+ nasa_exoplanet_archive = NasaExoplanetArchive ()
270
+
271
+ def mock_run_query (table = "ps" , get_query_payload = True , select = "count(*)" , where = "disc_facility like '%TESS%'" ):
272
+ assert table == "ps"
273
+ assert get_query_payload == True
274
+ assert select == "count(*)"
275
+ assert where == "disc_facility like '%TESS%'"
276
+ result = PropertyMock ()
277
+ result = {'table' : 'ps' , 'select' : 'count(*)' , 'where' : "disc_facility like '%TESS%'" , 'format' : 'ipac' }
278
+ return result
279
+ nasa_exoplanet_archive .query_criteria = mock_run_query
280
+ response = nasa_exoplanet_archive .query_criteria ()
281
+ assert 'ps' in response ['table' ]
282
+ assert 'count(*)' in response ['select' ]
283
+ assert "disc_facility like '%TESS%'" in response ['where' ]
284
+
0 commit comments