-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_geospatial.py
More file actions
51 lines (39 loc) · 2.04 KB
/
test_geospatial.py
File metadata and controls
51 lines (39 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import unittest
import stadiamaps
class TestGeospatial(unittest.TestCase):
def setUp(self):
self.configuration = stadiamaps.Configuration()
self.configuration.api_key["ApiKeyAuth"] = os.environ["STADIA_API_KEY"]
def tearDown(self):
pass
def testTZLookup(self):
with stadiamaps.ApiClient(self.configuration) as api_client:
api_instance = stadiamaps.GeospatialApi(api_client)
res = api_instance.tz_lookup(37.56, 126.99)
self.assertEqual("Asia/Seoul", res.tz_id)
def testTZLookupV2(self):
with stadiamaps.ApiClient(self.configuration) as api_client:
api_instance = stadiamaps.GeospatialApi(api_client)
res = api_instance.tz_lookup_v2(37.56, 126.99)
self.assertEqual("Asia/Seoul", res.tz_id)
self.assertIsInstance(res.utc_offset, int)
def testElevation(self):
with stadiamaps.ApiClient(self.configuration) as api_client:
api_instance = stadiamaps.GeospatialApi(api_client)
req = stadiamaps.HeightRequest(id="Seoul", shape=[stadiamaps.Coordinate(lat=37.56, lon=126.99)], range=False)
res = api_instance.elevation(req)
self.assertEqual(req.id, res.id)
self.assertGreaterEqual(len(res.height), 1)
self.assertGreaterEqual(res.height[0], 1)
self.assertEqual(res.shape, req.shape)
def testElevationRange(self):
with stadiamaps.ApiClient(self.configuration) as api_client:
api_instance = stadiamaps.GeospatialApi(api_client)
req = stadiamaps.HeightRequest(id="Seoul", shape=[stadiamaps.Coordinate(lat=37.56, lon=126.99)], range=True)
res = api_instance.elevation(req)
self.assertEqual(req.id, res.id)
self.assertGreaterEqual(len(res.range_height), 1)
self.assertEqual(res.range_height[0][0], 0) # This is always zero for the first element
self.assertGreaterEqual(res.range_height[0][1], 1)
self.assertEqual(res.shape, req.shape)