Skip to content

Commit

Permalink
Add web test for other urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Jan 3, 2024
1 parent 50101e4 commit 7421c79
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
24 changes: 19 additions & 5 deletions app/test_app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import unittest
import os
from datetime import datetime
import uvicorn
from fastapi import FastAPI
from fastapi.testclient import TestClient

from app import app
Expand All @@ -11,11 +7,29 @@


class TestApp(unittest.TestCase):
def test_read_main(self):
def test_landingpage(self):
response = client.get("/")
self.assertEqual(response.status_code, 200)
self.assertIn("EDR isobaric from Grib", response.text)


def test_conformance(self):
response = client.get("/conformance")
self.assertEqual(response.status_code, 200)
self.assertIn('{"conformsTo":["http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core",', response.text)


def test_collections(self):
response = client.get("/collections")
self.assertEqual(response.status_code, 200)
self.assertIn('{"links":[{"href":"http://localhost:5000/","hreflang":"en","rel":"self","type":"aplication/json"}],"collections":[{"id":"isobaric","title":"', response.text)


def test_point(self):
response = client.get("/collections/position?coords=POINT(60.1699 11.9384)")
self.assertEqual(response.status_code, 200)
self.assertIn('"vertical":{"interval":[["850.0"],["100.0"]],"values":["850.0","750.0","700.0","600.0","500.0","450.0","400.0","350.0","300.0","275.0","250.0","225.0","200.0","150.0","100.0"],"vrs":"Vertical Reference System: PressureLevel"}},', response.text)


if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dependencies:
- pylint
- tox
- bandit
- httpx
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- fastapi[all]==0.105.0
- uvicorn[standard]==0.24.0.post1
- eccodes
- eccodes==2.33.0
- cfgrib==0.9.10.4
- shapely==2.0.1
- xarray==2023.12.0
Expand Down

0 comments on commit 7421c79

Please sign in to comment.