Skip to content

Commit

Permalink
fixes on test case for entry preds;
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjan-stha committed Nov 21, 2023
1 parent c7a212d commit 1966df0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion analysis_module/mockserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from core.models import NLPRequest
from core_server.settings import ENDPOINT_NAME
from .mock_templates import MOCK_ENTRY_CLASSIFICATION_FORMATTED, MOCK_GEOLOCATION
from .mock_templates import MOCK_ENTRY_CLASSIFICATION, MOCK_ENTRY_CLASSIFICATION_FORMATTED, MOCK_GEOLOCATION
from .utils import send_callback_url_request


Expand Down
4 changes: 2 additions & 2 deletions analysis_module/tests/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,11 @@ def test_prediction_valid_data(self, model_prediction_class):
for item in predictions:
assert "client_id" in item
assert "model_preds" in item
assert NLPRequest.objects.filter(
assert not NLPRequest.objects.filter(
client_id=self.CLIENT_ID,
created_by=self.user,
status=NLPRequest.RequestStatus.SUCCESS,
).exists(), "NLP request should be created with success status"
).exists(), "No nlp request should be created"

@patch("analysis_module.views.predictions.ModelTagsPrediction")
def test_prediction_mock(self, model_prediction_class):
Expand Down
4 changes: 2 additions & 2 deletions analysis_module/views/predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from core_server.settings import IS_MOCKSERVER
from core.models import NLPRequest
from analysis_module.serializers import TagsMappingRequestSerializer, PredictionRequestSerializer
from analysis_module.mockserver import MOCK_ENTRY_CLASSIFICATION_FORMATTED
from analysis_module.mockserver import MOCK_ENTRY_CLASSIFICATION
from nlp_scripts.model_prediction.tags_mapping import AF2NLPMapping
from nlp_scripts.model_prediction.model_prediction import ModelTagsPrediction
from nlp_scripts.model_prediction.utils import get_vf_list
Expand Down Expand Up @@ -60,7 +60,7 @@ def entry_classification(request: Request):
serializer = PredictionRequestSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
if serializer.validated_data.get("mock") or IS_MOCKSERVER:
return Response(MOCK_ENTRY_CLASSIFICATION_FORMATTED)
return Response(MOCK_ENTRY_CLASSIFICATION)
entries = serializer.validated_data["entries"]
if not entries:
return Response({"classifications": []})
Expand Down

0 comments on commit 1966df0

Please sign in to comment.