From 1a8ee4807ac2e2c16e4c613bbf1704cc0a5bfe88 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 27 Feb 2024 17:32:41 +0100 Subject: [PATCH] replace expected http error 400 to 403 in threats and security functions --- backend/app_tests/api/test_api_security_functions.py | 4 ++-- backend/app_tests/api/test_api_threats.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/app_tests/api/test_api_security_functions.py b/backend/app_tests/api/test_api_security_functions.py index 2d780f39a..4f7c855ad 100644 --- a/backend/app_tests/api/test_api_security_functions.py +++ b/backend/app_tests/api/test_api_security_functions.py @@ -1,5 +1,5 @@ import pytest -from rest_framework import status +from rest_framework.status import HTTP_403_FORBIDDEN from rest_framework.test import APIClient from core.models import SecurityFunction from iam.models import Folder @@ -155,7 +155,7 @@ def test_update_security_function_with_urn(self, test): "folder": {"str": Folder.get_root_folder().name}, }, fails=True, - expected_status=status.HTTP_400_BAD_REQUEST, # Imported objects cannot be updated + expected_status=HTTP_403_FORBIDDEN, # Imported objects cannot be updated user_group=test.user_group, ) diff --git a/backend/app_tests/api/test_api_threats.py b/backend/app_tests/api/test_api_threats.py index 8155813ec..5d709f727 100644 --- a/backend/app_tests/api/test_api_threats.py +++ b/backend/app_tests/api/test_api_threats.py @@ -1,5 +1,5 @@ import pytest -from rest_framework.status import HTTP_400_BAD_REQUEST +from rest_framework.status import HTTP_403_FORBIDDEN from rest_framework.test import APIClient from core.models import Threat from iam.models import Folder @@ -134,7 +134,7 @@ def test_create_threats(self, test): user_group=test.user_group, ) - def test_update_threats_with_url(self, test): + def test_update_threats_with_urn(self, test): """test to update imported threat (with URN) with the API with authentication""" folder = Folder.objects.create(name="test2") @@ -158,7 +158,7 @@ def test_update_threats_with_url(self, test): "folder": str(folder.id), }, fails=True, - expected_status=HTTP_400_BAD_REQUEST, # Imported objects cannot be modified + expected_status=HTTP_403_FORBIDDEN, # Imported objects cannot be modified user_group=test.user_group, )