Skip to content

Commit

Permalink
Fixed test order
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Sep 24, 2019
1 parent 239e4ea commit 3be143b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
10 changes: 5 additions & 5 deletions .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
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
- image: postgres:10
environment:
POSTGRES_USER: ckan
Expand Down Expand Up @@ -65,13 +65,13 @@ jobs:
- run: |
mkdir -p ~/junit
case $CIRCLE_NODE_INDEX in
0) python -m pytest $PYTEST_COMMON_OPTIONS --test-group-count 4 --test-group 1
0) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 1
;;
1) python -m pytest $PYTEST_COMMON_OPTIONS --test-group-count 4 --test-group 2
1) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 2
;;
2) python -m pytest $PYTEST_COMMON_OPTIONS --test-group-count 4 --test-group 3
2) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 3
;;
3) python -m pytest $PYTEST_COMMON_OPTIONS --test-group-count 4 --test-group 4
3) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 4
;;
esac
- store_test_results:
Expand Down
74 changes: 37 additions & 37 deletions ckan/tests/legacy/functional/api/test_email_notifications.py
Expand Up @@ -17,17 +17,29 @@ def setup_class(cls):
tests.CreateTestData.create()
cls.app = helpers._get_test_app()
joeadmin = model.User.get('joeadmin')
cls.joeadmin = {'id': joeadmin.id,
'apikey': joeadmin.apikey,
}
cls.joeadmin = {
'id': joeadmin.id,
'apikey': joeadmin.apikey
}
testsysadmin = model.User.get('testsysadmin')
cls.testsysadmin = {'id': testsysadmin.id,
'apikey': testsysadmin.apikey,
}
cls.testsysadmin = {
'id': testsysadmin.id,
'apikey': testsysadmin.apikey
}
annafan = model.User.get('annafan')
cls.annafan = {'id': annafan.id,
'apikey': annafan.apikey,
}
cls.annafan = {
'id': annafan.id,
'apikey': annafan.apikey
}

# Register a new user.
cls.sara = tests.call_action_api(
cls.app, 'user_create',
apikey=cls.testsysadmin['apikey'], name='sara',
email='sara@sararollins.com', password='TestPassword1',
fullname='Sara Rollins',
activity_streams_email_notifications=True
)

@classmethod
def teardown_class(cls):
Expand Down Expand Up @@ -64,16 +76,6 @@ def test_01_no_email_notifications_after_registration(self):
apikey=self.testsysadmin['apikey'])
self.clear_smtp_messages()

# Register a new user.
sara = tests.call_action_api(self.app, 'user_create',
apikey=self.testsysadmin['apikey'], name='sara',
email='sara@sararollins.com', password='TestPassword1',
fullname='Sara Rollins',
activity_streams_email_notifications=True)

# Save the user for later tests to use.
TestEmailNotifications.sara = sara

# No notification emails should be sent to anyone at this point.
tests.call_action_api(self.app, 'send_email_notifications',
apikey=self.testsysadmin['apikey'])
Expand Down Expand Up @@ -188,13 +190,22 @@ def setup_class(cls):
tests.CreateTestData.create()
cls.app = helpers._get_test_app()
joeadmin = model.User.get('joeadmin')
cls.joeadmin = {'id': joeadmin.id,
'apikey': joeadmin.apikey,
}
cls.joeadmin = {
'id': joeadmin.id,
'apikey': joeadmin.apikey
}

testsysadmin = model.User.get('testsysadmin')
cls.testsysadmin = {'id': testsysadmin.id,
'apikey': testsysadmin.apikey,
}
cls.testsysadmin = {
'id': testsysadmin.id,
'apikey': testsysadmin.apikey
}
cls.sara = tests.call_action_api(
cls.app, 'user_create',
apikey=cls.testsysadmin['apikey'], name='sara',
email='sara@sararollins.com', password='TestPassword1',
fullname='Sara Rollins'
)

@classmethod
def teardown_class(self):
Expand All @@ -203,18 +214,7 @@ def teardown_class(self):

def test_00_email_notifications_disabled_by_default(self):
'''Email notifications should be disabled for new users.'''

# Register a new user.
sara = tests.call_action_api(self.app, 'user_create',
apikey=self.testsysadmin['apikey'], name='sara',
email='sara@sararollins.com', password='TestPassword1',
fullname='Sara Rollins')

# Save the user for later tests to use.
TestEmailNotificationsUserPreference.sara = sara

# Email notifications should be disabled for the new user.
assert sara['activity_streams_email_notifications'] is False
assert self.sara['activity_streams_email_notifications'] is False
assert (tests.call_action_api(self.app, 'user_show',
apikey=self.sara['apikey'], id='sara')[
'activity_streams_email_notifications'] is False)
Expand Down

0 comments on commit 3be143b

Please sign in to comment.