|
@@ 85-96 (lines=12) @@
|
| 82 |
|
expected_result = circuits['1'] |
| 83 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 84 |
|
|
| 85 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 86 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |
| 87 |
|
"""Test if get_circuit return invalid circuit_id.""" |
| 88 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 89 |
|
'2': {'name': 'circuit_2'}} |
| 90 |
|
storehouse_data_mock.return_value = circuits |
| 91 |
|
|
| 92 |
|
api = self.get_app_test_client(self.napp) |
| 93 |
|
url = f'{self.server_name_url}/v2/evc/3' |
| 94 |
|
response = api.get(url) |
| 95 |
|
expected_result = {'response': 'circuit_id 3 not found'} |
| 96 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 97 |
|
|
| 98 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 99 |
|
@patch('napps.kytos.mef_eline.scheduler.Scheduler.add') |
|
@@ 72-83 (lines=12) @@
|
| 69 |
|
expected_result = circuits |
| 70 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 71 |
|
|
| 72 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 73 |
|
def test_circuit_with_valid_id(self, storehouse_data_mock): |
| 74 |
|
"""Test if get_cirguit return the ciruit attributes.""" |
| 75 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 76 |
|
'2': {'name': 'circuit_2'}} |
| 77 |
|
storehouse_data_mock.return_value = circuits |
| 78 |
|
|
| 79 |
|
api = self.get_app_test_client(self.napp) |
| 80 |
|
url = f'{self.server_name_url}/v2/evc/1' |
| 81 |
|
response = api.get(url) |
| 82 |
|
expected_result = circuits['1'] |
| 83 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 84 |
|
|
| 85 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 86 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |