Skip to content

Commit

Permalink
all baseline tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Feb 27, 2024
1 parent 9383edb commit 6f99356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 44 deletions.
44 changes: 1 addition & 43 deletions yml_tests/test_Baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,6 @@ tests:
expected file: csv
expected code: 200

- baseline processing level:
reference: ALPSRP279071410
output: csv
processingLevel: L1.5
# use_maturity: True

expected file: csv
expected code: 200

- baseline processing level list:
reference: ALPSRP279071410
output: csv
processingLevel: L1.5,L1.0
# use_maturity: True

expected file: csv
expected code: 200

- baseline count:
reference: E1_23942_STD_F155
output: count
Expand Down Expand Up @@ -116,15 +98,7 @@ tests:
output: json
# use_maturity: True

expected file: json
expected code: 200

- baseline asf_search:
reference: S1B_IW_SLC__1SDV_20180112T141823_20180112T141850_009139_0105AA_E6F5
output: asf_search
# use_maturity: True

expected file: geojson
expected file: jsonlite # dropping json output
expected code: 200

- no output specified:
Expand Down Expand Up @@ -162,22 +136,6 @@ tests:
expected file: error json
expected code: 400

- requested processingLevel does not exist:
reference: E1_20936_STD_F155
processingLevel: L0.5
# use_maturity: True

expected file: jsonlite
expected code: 200

- missing stack ID:
reference: ALPSRS279162650
processinglevel: L1.0
# use_maturity: True

expected file: error json
expected code: 400

- Sentinel RAW without baseline:
reference: S1B_EW_RAW__0SDH_20200408T180120_20200408T180228_021056_027F1A_8312
# use_maturity: True
Expand Down
4 changes: 3 additions & 1 deletion yml_tests/test_baseline_manager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import requests, urllib # For talking w/ API
import json, csv # File stuff
import re # Opening/Reading the file stuff
Expand Down Expand Up @@ -129,14 +130,15 @@ def jsonToDict(json_data):
h = requests.head(self.query)
content_header = h.headers.get('content-type')
file_content = requests.get(self.query).content.decode("utf-8")

# text/csv; charset=utf-8
try:
content_type = content_header.split('/')[1]
except AttributeError:
assert False, self.error_msg.format("Header is not formatted as expected. Header: {0}. File Content: \n{1}\n".format(content_header, file_content))
# Take out the "csv; charset=utf-8", without crahsing on things without charset
content_type = content_type.split(';')[0] if ';' in content_type else content_type

logging.warning(content_header)
## COUNT / HTML:
if content_type == "html":
# They return a number in the html. Convert to a real int:
Expand Down

0 comments on commit 6f99356

Please sign in to comment.