Add entity ident test
This commit is contained in:
parent
afc919a21d
commit
dfca25e2e0
@ -1,29 +1,31 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from flask import jsonify
|
|
||||||
|
|
||||||
from components.entitiy_ident.entity_ident_service.entity_ident_server import app
|
from components.entitiy_ident.entity_ident_service.entity_ident_server import app
|
||||||
|
|
||||||
|
ENTITY_IDENT_URL = 'http://entityident:5002/api/v1/resources/'
|
||||||
|
|
||||||
|
|
||||||
class TestIdentServer(unittest.TestCase):
|
class TestIdentServer(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
self.app = app.test_client()
|
self.app = app.test_client()
|
||||||
|
|
||||||
def test_get_traffic_lights(self):
|
def test_get_traffic_lights(self):
|
||||||
response = requests.get('http://0.0.0.0:5002/api/v1/resources/traffic_lights')
|
response = requests.get(ENTITY_IDENT_URL + 'traffic_lights')
|
||||||
|
self.assertEqual(200, response.status_code)
|
||||||
|
data = response.json()['cursor']
|
||||||
|
self.assertIsNotNone(data[0]['id'])
|
||||||
|
|
||||||
|
def test_get_cars(self):
|
||||||
|
response = requests.get(ENTITY_IDENT_URL + 'cars')
|
||||||
|
self.assertEqual(200, response.status_code)
|
||||||
|
data = response.json()['cursor']
|
||||||
|
self.assertIsNotNone(data[0]['vin'])
|
||||||
|
|
||||||
|
def test_get_traffic_lights_geo(self):
|
||||||
|
response = requests.get(ENTITY_IDENT_URL + 'traffic_lights_geo?lat=47.92603&lon=16.20917')
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
data = response.json()['cursor']
|
data = response.json()['cursor']
|
||||||
self.assertEqual('3', data[0]['id'])
|
self.assertEqual('3', data[0]['id'])
|
||||||
|
|
||||||
def test_get_cars(self):
|
|
||||||
response = requests.get('http://0.0.0.0:5002/api/v1/resources/cars')
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
data = response.json()['cursor']
|
|
||||||
self.assertEqual('5GZCZ43D13S812716', data[0]['vin'])
|
|
||||||
|
|
||||||
def test_get_traffic_light_events(self):
|
|
||||||
response = requests.get('http://0.0.0.0:5002/api/v1/resources/traffic_light_events?id=3')
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
data = response.json()['cursor']
|
|
||||||
self.assertEqual('5GZCZ43D13S812716', data[0]['vin'])
|
|
||||||
Loading…
x
Reference in New Issue
Block a user