Skip to content

Commit e07691e

Browse files
Jorge Fernandez HernandezJorge Fernandez Hernandez
authored andcommitted
GAIAPCR-1341 new test for the method get_file_from_header
1 parent 206abf1 commit e07691e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

astroquery/utils/tap/conn/tests/test_conn.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,22 @@ def test_find_all_headers():
152152

153153
assert (result[0] == "JSESSIONID=E677B51BA5C4837347D1E17D4E36647E; Path=/data-server; Secure; HttpOnly")
154154
assert (result[1] == "SESSION=ZjQ3MjIzMDAtNjNiYy00Mj; Path=/data-server; Secure; HttpOnly; SameSite=Lax")
155+
156+
157+
def test_get_file_from_header():
158+
host = "testHost"
159+
tap = TapConn(ishttps=False, host=host)
160+
161+
headers = [('Date', 'Sat, 12 Apr 2025 05:10:47 GMT'),
162+
('Server', 'Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips mod_jk/1.2.43'),
163+
('Set-Cookie', 'JSESSIONID=E677B51BA5C4837347D1E17D4E36647E; Path=/data-server; Secure; HttpOnly'),
164+
('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'),
165+
('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate'), ('Pragma', 'no-cache'),
166+
('Expires', '0'), ('X-Frame-Options', 'SAMEORIGIN'),
167+
('Set-Cookie', 'SESSION=ZjQ3MjIzMDAtNjNiYy00Mj; Path=/data-server; Secure; HttpOnly; SameSite=Lax'),
168+
('Transfer-Encoding', 'chunked'), ('Content-Type', 'text/plain; charset=UTF-8'),
169+
('Content-Disposition', 'filename="my_file.vot.gz"'), ('Content-Encoding', "gzip")]
170+
171+
result = tap.get_file_from_header(headers)
172+
173+
assert (result == "my_file.vot.gz")

0 commit comments

Comments
 (0)