1
1
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2
2
"""
3
-
4
3
@author: Elena Colomo
5
4
6
-
7
5
European Space Astronomy Centre (ESAC)
8
6
European Space Agency (ESA)
9
-
10
7
Created on 4 Sept. 2019
11
8
"""
12
- < << << << HEAD
13
9
from unittest .mock import patch
14
- == == == =
15
- from unittest .mock import patch , MagicMock
16
- > >> >> >> 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
17
10
18
11
import pytest
19
12
import tarfile
27
20
from astroquery .exceptions import LoginError
28
21
29
22
30
- < << << << HEAD
31
23
class mockResponse ():
32
- == == == =
33
- class mockResponse :
34
- > >> >> >> 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
35
24
headers = {'Date' : 'Wed, 24 Nov 2021 13:43:50 GMT' ,
36
25
'Server' : 'Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips' ,
37
26
'Content-Disposition' : 'inline; filename="0560181401.tar.gz"' ,
@@ -42,13 +31,8 @@ class mockResponse:
42
31
@staticmethod
43
32
def raise_for_status ():
44
33
pass
45
- < << << << HEAD
46
-
47
-
48
- == == == =
49
34
50
35
51
- >> >> >> > 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
52
36
class TestXMMNewton ():
53
37
def get_dummy_tap_handler (self ):
54
38
parameters = {'query' : "select top 10 * from v_public_observations" ,
@@ -543,7 +527,6 @@ def test_request_link(self, mock_request):
543
527
params = xsa ._request_link ("https://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?obsno=0560181401" , None )
544
528
assert params == {'filename' : '0560181401.tar.gz' }
545
529
546
- < << << << HEAD
547
530
@pytest .mark .xfail (raises = LoginError )
548
531
@patch ('astroquery.query.BaseQuery._request' )
549
532
def test_request_link_protected (self , mock_request ):
@@ -563,8 +546,6 @@ def test_request_link_incorrect_credentials(self, mock_request):
563
546
mock_request .return_value = dummyclass
564
547
xsa ._request_link ("https://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?obsno=0560181401" , None )
565
548
566
- == == == =
567
- >> >> >> > 40576 ad4 (xmm_newton - 1.1_ issue1093 Refactored the download data method and added the corresponding tests )
568
549
def test_get_username_and_password (self ):
569
550
xsa = XMMNewtonClass (self .get_dummy_tap_handler ())
570
551
username , password = xsa ._get_username_and_password ("astroquery/esa/xmm_newton/tests/my_config.ini" )
@@ -579,4 +560,4 @@ def test_create_filename_None(self):
579
560
def test_create_filename_Not_None (self ):
580
561
xsa = XMMNewtonClass (self .get_dummy_tap_handler ())
581
562
filename = xsa ._create_filename ("Test" , "0560181401" , ['.tar' , '.gz' ])
582
- assert filename == "Test.tar.gz"
563
+ assert filename == "Test.tar.gz"
0 commit comments