|
@@ 253-264 (lines=12) @@
|
| 250 |
|
expected_result = circuits['1'] |
| 251 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 252 |
|
|
| 253 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 254 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |
| 255 |
|
"""Test if get_circuit return invalid circuit_id.""" |
| 256 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 257 |
|
'2': {'name': 'circuit_2'}} |
| 258 |
|
storehouse_data_mock.return_value = circuits |
| 259 |
|
|
| 260 |
|
api = self.get_app_test_client(self.napp) |
| 261 |
|
url = f'{self.server_name_url}/v2/evc/3' |
| 262 |
|
response = api.get(url) |
| 263 |
|
expected_result = {'response': 'circuit_id 3 not found'} |
| 264 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 265 |
|
|
| 266 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 267 |
|
@patch('napps.kytos.mef_eline.scheduler.Scheduler.add') |
|
@@ 240-251 (lines=12) @@
|
| 237 |
|
expected_result = circuits |
| 238 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 239 |
|
|
| 240 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 241 |
|
def test_circuit_with_valid_id(self, storehouse_data_mock): |
| 242 |
|
"""Test if get_circuit return the circuit attributes.""" |
| 243 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 244 |
|
'2': {'name': 'circuit_2'}} |
| 245 |
|
storehouse_data_mock.return_value = circuits |
| 246 |
|
|
| 247 |
|
api = self.get_app_test_client(self.napp) |
| 248 |
|
url = f'{self.server_name_url}/v2/evc/1' |
| 249 |
|
response = api.get(url) |
| 250 |
|
expected_result = circuits['1'] |
| 251 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 252 |
|
|
| 253 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 254 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |