Skip to content

Commit

Permalink
fix: Add mock up for the return_value
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalch committed Jul 4, 2024
1 parent 957d462 commit e156c8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ckanext/switzerland/tests/test_subscription_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ def setup(self):
def teardown(self):
tk.config["ckanext.subscribe.apply_recaptcha"] = "false"

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

mock_post.return_value = mock.Mock(
status_code=200, json=lambda: {"success": True}
)
# Create a subscription with a valid reCAPTCHA response
subscription = factories.Subscription(
dataset_id=self.dataset['id'],
Expand Down

0 comments on commit e156c8e

Please sign in to comment.