Skip to content

Commit

Permalink
Merge some of stateful tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Sep 27, 2019
1 parent ca4464a commit d223448
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
CKAN_POSTGRES_PWD: pass
PGPASSWORD: ckan
NODE_TESTS_CONTAINER: 2
PYTEST_COMMON_OPTIONS: -v --ckan-ini=test-core-circle-ci.ini --cov=ckan --cov=ckanext --junitxml=/root/junit/junit.xml --test-group-count 4 --test-group-random-seed=12345
PYTEST_COMMON_OPTIONS: -v --ckan-ini=test-core-circle-ci.ini --cov=ckan --cov=ckanext --junitxml=/root/junit/junit.xml --test-group-count 4
- image: postgres:10
environment:
POSTGRES_USER: ckan
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/config/test_middleware.py
Expand Up @@ -392,7 +392,7 @@ def test_no_beaker_secret_crashes(make_app):
# TODO: When Pylons is finally removed, we should test for
# RuntimeError instead (thrown on `make_flask_stack`)
with pytest.raises(ValueError,
match=ur"'secret' or 'secretfile' must not be None"):
match=u"'secret' or 'secretfile' must not be None"):
make_app()


Expand Down
3 changes: 2 additions & 1 deletion ckan/tests/controllers/test_admin.py
@@ -1,7 +1,7 @@
# encoding: utf-8

from nose.tools import assert_true, assert_equal

import pytest
from bs4 import BeautifulSoup
from ckan.lib.helpers import url_for
from ckan.common import config
Expand Down Expand Up @@ -36,6 +36,7 @@ def _reset_config(app):
)


@pytest.mark.usefixtures('reset_db')
class TestConfig(helpers.FunctionalTestBase):
'''View tests to go along with 'Customizing look and feel' docs.'''

Expand Down
16 changes: 8 additions & 8 deletions ckan/tests/legacy/functional/api/test_email_notifications.py
Expand Up @@ -61,14 +61,14 @@ def test_00_send_email_notifications_not_logged_in(self):
tests.call_action_api(self.app, 'send_email_notifications',
status=403)

def test_00_send_email_notifications_not_authorized(self):
# def test_00_send_email_notifications_not_authorized(self):
'''Unauthorized users shouldn't be able to send email notifications.
'''
tests.call_action_api(self.app, 'send_email_notifications',
apikey=self.annafan['apikey'], status=403)

def test_01_no_email_notifications_after_registration(self):
# def test_01_no_email_notifications_after_registration(self):
'''A new user who isn't following anything shouldn't get any emails.'''

# Clear any emails already sent due to CreateTestData.create().
Expand All @@ -81,7 +81,7 @@ def test_01_no_email_notifications_after_registration(self):
apikey=self.testsysadmin['apikey'])
assert len(self.get_smtp_messages()) == 0

def test_02_one_new_activity(self):
# def test_02_one_new_activity(self):
'''A user with one new activity should get one email.'''

# Make Sara follow something, have to do this to get new activity.
Expand All @@ -105,7 +105,7 @@ def test_02_one_new_activity(self):

self.clear_smtp_messages()

def test_03_multiple_new_activities(self):
# def test_03_multiple_new_activities(self):
'''Test that a user with multiple new activities gets just one email.
'''
Expand All @@ -127,7 +127,7 @@ def test_03_multiple_new_activities(self):

self.clear_smtp_messages()

def test_04_no_repeat_email_notifications(self):
# def test_04_no_repeat_email_notifications(self):
'''Test that a user does not get a second email notification for the
same new activity.
Expand All @@ -138,7 +138,7 @@ def test_04_no_repeat_email_notifications(self):
apikey=self.testsysadmin['apikey'])
assert len(self.get_smtp_messages()) == 0

def test_05_no_email_if_seen_on_dashboard(self):
# def test_05_no_email_if_seen_on_dashboard(self):
'''Test that emails are not sent for activities already seen on dash.
If a user gets some new activities in her dashboard activity stream,
Expand Down Expand Up @@ -166,11 +166,11 @@ def test_05_no_email_if_seen_on_dashboard(self):
apikey=self.testsysadmin['apikey'])
assert len(self.get_smtp_messages()) == 0

def test_05_no_email_notifications_when_disabled_site_wide(self):
# def test_05_no_email_notifications_when_disabled_site_wide(self):
'''Users should not get email notifications when the feature is
disabled site-wide by a sysadmin.'''

def test_06_enable_email_notifications_sitewide(self):
# def test_06_enable_email_notifications_sitewide(self):
'''When a sysadamin enables email notifications site wide, users
should not get emails for new activities from before email
notifications were enabled.
Expand Down

0 comments on commit d223448

Please sign in to comment.