Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansberry committed Dec 4, 2024
1 parent e639011 commit 3823024
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import datetime



@pytest.mark.ckan_config('ckan.plugins')
@pytest.mark.usefixtures("with_plugins")
@pytest.mark.usefixtures("clean_db")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
from unittest import mock


@pytest.fixture
def sysadmin_context():
sysadmin = ckan_factories.Sysadmin()
# helpers.call_action sets 'ignore_auth' to True by default
context = {'user': sysadmin['name'], 'ignore_auth': False}
return context


@pytest.mark.ckan_config('ckan.plugins')
@pytest.mark.usefixtures("with_plugins")
@pytest.mark.usefixtures("clean_db")
Expand Down Expand Up @@ -59,7 +51,7 @@ def test_sms_notifications_disabled_enabled(notifications_enabled):
@pytest.mark.usefixtures("with_plugins")
@mock.patch('ckanext.dataset_subscriptions.actions.twilio_notifications.client.messages.create')
def test_if_notifications_are_generated(create_message_mock, sysadmin_context):
create_user_with_resources(with_activity=True, with_notifications_enabled=True)
create_user_with_resources(True, True)
expected_sid = 'SM87105da94bff44b999e4e6eb90d8eb6a'
create_message_mock.return_value.sid = expected_sid
sid = helpers.call_action("send_sms_notifications")
Expand Down
12 changes: 11 additions & 1 deletion ckanext/dataset_subscriptions/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import pytest
from ckan.tests import factories as ckan_factories


@pytest.fixture
def sysadmin_context():
sysadmin = ckan_factories.Sysadmin()
# helpers.call_action sets 'ignore_auth' to True by default
context = {'user': sysadmin['name'], 'ignore_auth': False}
return context


@pytest.fixture()
def clean_db(reset_db, migrate_db_for):
reset_db()
migrate_db_for("activity")
migrate_db_for("activity")

0 comments on commit 3823024

Please sign in to comment.