|
@@ 151-162 (lines=12) @@
|
| 148 |
|
expected_result = circuits['1'] |
| 149 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 150 |
|
|
| 151 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 152 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |
| 153 |
|
"""Test if get_circuit return invalid circuit_id.""" |
| 154 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 155 |
|
'2': {'name': 'circuit_2'}} |
| 156 |
|
storehouse_data_mock.return_value = circuits |
| 157 |
|
|
| 158 |
|
api = self.get_app_test_client(self.napp) |
| 159 |
|
url = f'{self.server_name_url}/v2/evc/3' |
| 160 |
|
response = api.get(url) |
| 161 |
|
expected_result = {'response': 'circuit_id 3 not found'} |
| 162 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 163 |
|
|
| 164 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 165 |
|
@patch('napps.kytos.mef_eline.scheduler.Scheduler.add') |
|
@@ 138-149 (lines=12) @@
|
| 135 |
|
expected_result = circuits |
| 136 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 137 |
|
|
| 138 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 139 |
|
def test_circuit_with_valid_id(self, storehouse_data_mock): |
| 140 |
|
"""Test if get_circuit return the circuit attributes.""" |
| 141 |
|
circuits = {'1': {'name': 'circuit_1'}, |
| 142 |
|
'2': {'name': 'circuit_2'}} |
| 143 |
|
storehouse_data_mock.return_value = circuits |
| 144 |
|
|
| 145 |
|
api = self.get_app_test_client(self.napp) |
| 146 |
|
url = f'{self.server_name_url}/v2/evc/1' |
| 147 |
|
response = api.get(url) |
| 148 |
|
expected_result = circuits['1'] |
| 149 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 150 |
|
|
| 151 |
|
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.get_data') |
| 152 |
|
def test_circuit_with_invalid_id(self, storehouse_data_mock): |