Skip to content

Commit

Permalink
adjusted Update view
Browse files Browse the repository at this point in the history
  • Loading branch information
mlodic committed May 13, 2024
1 parent 402a1af commit f4dd486
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions api_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,4 +922,8 @@ def pull(self, request, name=None):
{"detail": "Unexpected exception raised. Check the code."}
)
else:
if update_status is None:
raise ValidationError(
{"detail": "This Plugin has no Update implemented"}
)
return Response(data={"status": update_status}, status=status.HTTP_200_OK)
7 changes: 5 additions & 2 deletions tests/api_app/analyzers_manager/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ def test_pull(self):
self.assertIn("status", result)
self.assertTrue(result["status"])

analyzer = "QuarkEngine"
analyzer = "Doc_Info"
response = self.client.post(f"{self.URL}/{analyzer}/pull")
self.assertEqual(response.status_code, 400)
result = response.json()
print(result)
self.assertIn("errors", result)
self.assertIn("detail", result["errors"])
self.assertEqual(result["errors"]["detail"], "No update implemented")
self.assertEqual(
result["errors"]["detail"], "This Plugin has no Update implemented"
)

def test_health_check(self):
analyzer = "ClamAV"
Expand Down

0 comments on commit f4dd486

Please sign in to comment.