Skip to content

Commit

Permalink
feat: Allows you to return an exact schema value in the test plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro-Meireles committed May 31, 2024
1 parent 2b7adc3 commit 6f8dbfb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apip/middlewares/subdomain_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def __call__(self, request: Request) -> Response:
try:
service = Service.objects.get(name__icontains=subdomain)
test_plan = service.plans.get(endpoint=path)

if test_plan.exact_value:
return JsonResponse(test_plan.schema, status=200)

fake_data = get_faker().generate_data_by_schema(test_plan.schema)
return JsonResponse(fake_data, status=200)

Expand Down

0 comments on commit 6f8dbfb

Please sign in to comment.