2021-06-18 07:28:08 +02:00

29 lines
1.1 KiB
Python

import unittest
import requests
from flask import jsonify
from components.entitiy_ident.entity_ident_service.entity_ident_server import app
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')
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'])