EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESA
PRISM
VS
Commits
933ff9b6
Commit
933ff9b6
authored
4 years ago
by
Mussab Abdalla
Browse files
Options
Downloads
Patches
Plain Diff
adding renderer test
parent
e2ea967b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testing/renderer_test.py
+71
-0
71 additions, 0 deletions
testing/renderer_test.py
with
71 additions
and
0 deletions
testing/renderer_test.py
0 → 100644
+
71
−
0
View file @
933ff9b6
import
requests
import
pytest
import
csv
import
subprocess
import
json
from
xml.etree
import
ElementTree
from
osgeo
import
gdal
from
urllib.parse
import
unquote
@pytest.fixture
def
identifiers
():
with
open
(
'
./product_list.csv
'
)
as
f
:
yield
csv
.
reader
(
f
)
def
get_requests
(
url
,
service_list
,
service
,
request
):
response
=
requests
.
get
(
url
=
url
)
catalog
=
ElementTree
.
fromstring
(
response
.
content
)
entries
=
catalog
.
findall
(
'
{http://www.w3.org/2005/Atom}entry
'
)
for
entry
in
entries
:
offers
=
entry
.
findall
(
'
{http://www.opengis.net/owc/1.0}offering[@code=
"
http://www.opengis.net/spec/owc-atom/1.0/req/%s
"
]
'
%
service
)
for
offer
in
offers
:
services
=
offer
.
findall
(
'
{http://www.opengis.net/owc/1.0}operation[@code=
"
%s
"
]
'
%
request
)
if
len
(
services
)
>
0
:
service_list
.
append
(
services
[
0
].
get
(
'
href
'
))
return
service_list
def
test_renderer
(
identifiers
):
wms_items
=
get_requests
(
'
http://127.0.0.1:81/opensearch/collections/Emergency/atom/
'
,
[],
'
wms
'
,
'
GetMap
'
)
for
row
in
identifiers
:
identifier
=
row
[
0
].
split
(
'
/
'
)[
4
]
for
item
in
wms_items
:
if
identifier
in
unquote
(
unquote
(
item
))
:
wms_response
=
requests
.
get
(
url
=
item
)
# wms succsess
assert
wms_response
.
status_code
==
200
def
test_wcs
(
identifiers
):
wcs_items
=
get_requests
(
'
http://127.0.0.1:81/opensearch/collections/Emergency/atom/
'
,
[],
'
wcs
'
,
'
GetCoverage
'
)
for
row
in
identifiers
:
identifier
=
row
[
0
].
split
(
'
/
'
)[
4
]
for
item
in
wcs_items
:
if
identifier
in
unquote
(
unquote
(
item
))
:
wcs_response
=
requests
.
get
(
url
=
item
+
'
&scalesize=x(50),y(50)
'
)
data
=
wcs_response
.
content
with
open
(
'
temp.tif
'
,
'
wb
'
)
as
f
:
f
.
write
(
data
)
image
=
gdal
.
Open
(
'
temp.tif
'
,
gdal
.
GA_ReadOnly
)
srcband
=
image
.
GetRasterBand
(
1
)
# wcs succsess
assert
wcs_response
.
status_code
==
200
assert
srcband
.
Checksum
()
!=
None
assert
srcband
.
Checksum
()
>
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment