From ad6ae86615ed87b88f1746cbb87155a45a03b2c7 Mon Sep 17 00:00:00 2001 From: Iuri Malinoski Date: Wed, 11 Sep 2024 13:25:36 -0300 Subject: [PATCH] Better error message in the exception. --- README.md | 5 ++++- networkapi/api_neighbor/v4/exceptions.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7caa9686..4b42c71a 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,11 @@ It was not created to be and inventory database, so it does not have CMDB functi ## Documentation [Documentation](http://globonetworkapi.readthedocs.org/) +## Run API +Run `make build_img && make start` and visit `http://localhost:8000/healthcheck` if running locally. + ## Run Unit Tests -To run the unit tests just run `make build_img && make start && make test_ci` this instruction will run all the unit tests specified in the `networkapi/tests/__init__.py` file. +Run `make test_ci`. This command will run all the unit tests specified in the `networkapi/tests/__init__.py` file. ## Create and run migrations To create a new migration, just run into app container `cd dbmigrate; db-migrate --new=`. This step will create a enpty migration file, you must write the SQL statement. diff --git a/networkapi/api_neighbor/v4/exceptions.py b/networkapi/api_neighbor/v4/exceptions.py index 187f1d3f..c2df486e 100644 --- a/networkapi/api_neighbor/v4/exceptions.py +++ b/networkapi/api_neighbor/v4/exceptions.py @@ -123,9 +123,11 @@ class RemoteIpAndRemoteAsnAtDifferentEquipmentsException(APIException): status_code = status.HTTP_400_BAD_REQUEST def __init__(self, neighbor): - self.detail = u'RemoteIp id = {} and RemoteAsn id = {} belongs to ' \ - u'different Equipments'.\ - format(neighbor.remote_ip, neighbor.remote_asn) + # self.detail = u'RemoteIp id = {} and RemoteAsn id = {} belongs to ' \ + # u'different Equipments'.\ + # format(neighbor.remote_ip, neighbor.remote_asn) + self.detail = u'O ASN remoto (id: {}) não está associado a qualquer equipamento do IP (id: {}). '.\ + format(neighbor.remote_asn, neighbor.remote_ip) class LocalIpAndPeerGroupAtDifferentEnvironmentsException(APIException):