Skip to content

Commit

Permalink
fix: remove post request mock
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalch committed Jul 2, 2024
1 parent 41f7a00 commit 8cc96e5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ckanext/subscribe/tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,9 @@ def test_verify_recaptcha_success(
)
assert subscription_obj

@mock.patch("requests.post")
@mock.patch("ckanext.subscribe.email_verification.send_request_email")
@mock.patch("ckanext.subscribe.action._verify_recaptcha")
def test_verify_recaptcha_failure(
self, mock_verify_recaptcha, send_request_email, mock_post
):
def test_verify_recaptcha_failure(self, mock_verify_recaptcha, send_request_email):
# Mocking the reCAPTCHA verification to return False
mock_verify_recaptcha.return_value = False

Expand All @@ -297,7 +294,7 @@ def test_verify_recaptcha_failure(
)
except ValidationError as e:
# Asserting that the error is raised with the correct message
assert "Invalid reCAPTCHA. Please try again." in str(e)
assert "Invalid reCAPTCHA. Please try again." in str(e.error_dict)

# Ensuring the email is not sent due to invalid reCAPTCHA
assert not send_request_email.called
Expand Down

0 comments on commit 8cc96e5

Please sign in to comment.