diff --git a/components/entitiy_ident/entity_ident_service/test_ident_server.py b/components/entitiy_ident/entity_ident_service/test_ident_server.py index 73efabd..630ba3c 100644 --- a/components/entitiy_ident/entity_ident_service/test_ident_server.py +++ b/components/entitiy_ident/entity_ident_service/test_ident_server.py @@ -1,29 +1,31 @@ import unittest import requests -from flask import jsonify 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): + def setUp(self) -> None: self.app = app.test_client() 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) data = response.json()['cursor'] 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']) \ No newline at end of file