EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 35d6d999 authored by Mussab Abdalla's avatar Mussab Abdalla
Browse files

complete initial report testing

parent ecca5b0e
No related branches found
No related tags found
No related merge requests found
import psycopg2
import os
import csv
from xml.etree import ElementTree
with open('./env/emg_db.env', 'r') as f:
......@@ -42,6 +43,22 @@ def test_db_name(name):
spamreader = csv.reader(csvfile)
for row in spamreader:
identifier = row[0].split('/')[4]
xml_file= "%s.xml"% identifier
tree = ElementTree.parse(xml_file)
root = tree.getroot()
urls = root.findall('{http://www.telespazio.com/CSCDA/CDD/PDAS}URL')
wms_link = urls[0].find('{http://www.telespazio.com/CSCDA/CDD/PDAS}URL').text
wcs_link = urls[1].find('{http://www.telespazio.com/CSCDA/CDD/PDAS}URL').text
wms_capabilities = 'emg.pass.copernicus.eu/ows?service=wms&request=GetCapabilities&amp&cql=identifier='
wcs_capabilities = 'emg.pass.copernicus.eu/ows?service=wcs&request=GetCapabilities&amp&cql=identifier='
expected_wms_link = '%s"%s"' % (wms_capabilities, identifier)
expected_wcs_link = '%s"%s"' % (wcs_capabilities, identifier)
assert expected_wms_link.replace('&amp&', '&') == wms_link
assert expected_wcs_link.replace('&amp&', '&') == wcs_link
connect_to_db(identifier)
assert coverage_id == identifier
assert db_name == database
......
......@@ -2,7 +2,7 @@
product_list_file=$1
docker exec -i $(docker ps -qf "name=emg-pvs_registrar") python3 /var/www/pvs/dev/pvs_instance/manage.py storage create pvs_testing pvs_testing --type swift --storage-auth auth-cloud-ovh
IFS=","
# For testing the service url and the reporting directory canbe fixed and not mapped from env
# For testing purposses 'service url' and 'reporting directory' values can be fixed and not mapped from env
SERVICE_URL=emg.pass.copernicus.eu
REPORTING_DIR=/mnt/reports/
while read product; do
......@@ -15,14 +15,19 @@ echo "docker exec -i $(docker ps -qf "name=emg-pvs_registrar") python3 /core/reg
while IFS="" read -r name
do
docker exec $(docker ps -qf "name=emg-pvs_registrar") cat /mnt/reports/$name >> ${ADDR[4]}.xml
docker exec $(docker ps -qf "name=emg-pvs_registrar") cat /mnt/reports/$name > temp.xml
tail -n +2 temp.xml > ${ADDR[4]}.xml
done < ${ADDR[4]}.csv
rm ${ADDR[4]}.csv
rm ${ADDR[4]}.csv temp.xml
done < $product_list_file
pytest -s registrar_test.py --name $product_list_file
# Remove the created xml reports
while read product; do
IFS='/' read -ra ADDR <<< "$product"
rm ${ADDR[4]}.xml
done < $product_list_file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment