Commit f032350e authored by Derek Homeier's avatar Derek Homeier
Browse files

Test meta and binary data access via HTTP (no GridFS)

parent f277eea8
Pipeline #2480 passed with stage
in 3 minutes and 40 seconds
......@@ -5,6 +5,7 @@ from urllib.error import HTTPError, URLError
import json
import astropy.units as u
from astropy.io import fits
from sunpy.net import attrs as a
from sunpy.net.base_client import QueryResponseTable
......@@ -57,6 +58,29 @@ def test_docker(client):
assert description['TELESCOPE'] == 'GREGOR'
assert description['BTYPE'] == 'phot.count'
links = res[0]['_embedded'][0].get('links')
oid = links['l1_data'][0]['$oid']
meta = json.loads(urllib.request.urlopen(f"{_BASE_URL}gris_l1_data.files/{oid}").read())
assert meta['_id']['$oid'] == oid
hdulist = fits.open(f"{_BASE_URL}gris_l1_data.files/{oid}/binary")
assert hdulist[0].header.get('TELESCOP') == 'GREGOR'
assert '2014-04-26T' in hdulist[0].header.get('DATE-OBS')
def test_gridfs(client):
"""Test gridfs access on dockertest."""
pytest.xfail("No GridFS on gitlab-runner")
import gridfs
from kis_tools.generic import get_sdc_connection
res = client.search(a.Instrument("GRIS") & a.sdc.ObsName('gris_20140426_000'))
links = res[0]['_embedded'][0].get('links')
file_ids = [ld['$oid'] for ld in links['l1_data']]
sdc = get_sdc_connection()
gfs = gridfs.GridFS(sdc.sdc_test, "gris_l1_data")
found = gfs.find({"_id": {"$in": file_ids}})
assert(len(found)) == 50
def test_search(client):
"""Test conversion of (supported) Attrs to query string."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment