Skip to content

Commit

Permalink
Fixed issue kytos#128, GET /v2/evc/<circuit_id> 404
Browse files Browse the repository at this point in the history
  • Loading branch information
viniarck committed Jan 12, 2022
1 parent 4084a94 commit 309f7d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_circuit(self, circuit_id):
except KeyError:
result = f"circuit_id {circuit_id} not found"
log.debug("get_circuit result %s %s", result, 404)
raise BadRequest(result) from KeyError
raise NotFound(result) from KeyError
status = 200
log.debug("get_circuit result %s %s", result, status)
return jsonify(result), status
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,13 @@ def test_delete_schedule_not_found(self, mock_find_evc_by_sched):
response = api.delete(url)
self.assertEqual(response.status_code, 404)

def test_get_circuit_not_found(self):
"""Test /v2/evc/<circuit_id> 404."""
api = self.get_app_test_client(self.napp)
url = f'{self.server_name_url}/v2/evc/1234'
response = api.get(url)
self.assertEqual(response.status_code, 404)

@patch('requests.post')
@patch('napps.kytos.mef_eline.scheduler.Scheduler.add')
@patch('napps.kytos.mef_eline.storehouse.StoreHouse.save_evc')
Expand Down

0 comments on commit 309f7d1

Please sign in to comment.