|
@@ 95-106 (lines=12) @@
|
| 92 |
|
expected_result = circuits['1'] |
| 93 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 94 |
|
|
| 95 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 96 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |
| 97 |
|
"""Test if get_circuit return invalid circuit_id.""" |
| 98 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 99 |
|
'2': {'name': 'circuit_2'}} |
| 100 |
|
storehouse_data_mock.return_value = circuits |
| 101 |
|
|
| 102 |
|
api = self.get_app_test_client(self.napp) |
| 103 |
|
url = f'{self.server_name_url}/v2/evc/3' |
| 104 |
|
response = api.get(url) |
| 105 |
|
expected_result = {'response': 'circuit_id 3 not found'} |
| 106 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 107 |
|
|
| 108 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 109 |
|
@patch('napps.kytos.mef_eline.scheduler.Scheduler.add') |
|
@@ 82-93 (lines=12) @@
|
| 79 |
|
expected_result = circuits |
| 80 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 81 |
|
|
| 82 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 83 |
|
def test_circuit_with_valid_id(self, storehouse_data_mock): |
| 84 |
|
"""Test if get_circuit return the circuit attributes.""" |
| 85 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 86 |
|
'2': {'name': 'circuit_2'}} |
| 87 |
|
storehouse_data_mock.return_value = circuits |
| 88 |
|
|
| 89 |
|
api = self.get_app_test_client(self.napp) |
| 90 |
|
url = f'{self.server_name_url}/v2/evc/1' |
| 91 |
|
response = api.get(url) |
| 92 |
|
expected_result = circuits['1'] |
| 93 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 94 |
|
|
| 95 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 96 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |