Skip to content

Commit

Permalink
[#2034] bodge together and get more info from activity tests that onl…
Browse files Browse the repository at this point in the history
…y fail on travis
  • Loading branch information
wardi committed Nov 10, 2014
1 parent c04c273 commit db7a5ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions ckan/tests/functional/api/test_activity.py
Expand Up @@ -1200,7 +1200,7 @@ def test_01_delete_resources(self):
"""
packages_with_resources = []
for package_name in package_list(self.app):
for package_name in ['annakarenina', 'warandpeace']:
package_dict = package_show(self.app, {'id': package_name})
if len(package_dict['resources']) > 0:
packages_with_resources.append(package_dict)
Expand All @@ -1218,7 +1218,8 @@ def test_01_update_group(self):
"""
for group in group_list(self.app):
self._update_group(group, user=self.sysadmin_user)
if group['name'] == 'david' or group['name'] == 'roger':
self._update_group(group, user=self.sysadmin_user)

def test_01_remove_tag(self):
"""
Expand Down Expand Up @@ -1330,7 +1331,7 @@ def test_01_update_package(self):
when packages are updated.
"""
for package_name in package_list(self.app):
for package_name in ['annakarenina', 'warandpeace']:
package_dict = package_show(self.app, {'id': package_name})
self._update_package(package_dict, user=self.normal_user)

Expand Down Expand Up @@ -1399,7 +1400,7 @@ def test_create_user(self):
a new user is created.
"""
before = datetime.datetime.now()
before_now = datetime.datetime.now()

# Create a new user.
user_dict = {'name': 'testuser',
Expand All @@ -1417,7 +1418,7 @@ def test_create_user(self):

user_activities = after['user activity stream']
assert len(user_activities) == 1, ("There should be 1 activity in "
"the user's activity stream, but found %i" % len(user_activities))
"the user's activity stream, but found %r" % new_activities)
activity = user_activities[0]

# Check that the new activity has the right attributes.
Expand All @@ -1433,7 +1434,7 @@ def test_create_user(self):
if 'revision_id' not in activity:
assert False, "activity object should have a revision_id value"
timestamp = datetime_from_string(activity['timestamp'])
assert timestamp >= before and timestamp <= after['time'], \
assert timestamp >= before_now and timestamp <= after['time'], \
str(activity['timestamp'])

details = self.activity_details(activity)
Expand Down
4 changes: 2 additions & 2 deletions ckan/tests/functional/api/test_dashboard.py
Expand Up @@ -103,7 +103,7 @@ def test_01_dashboard_activity_list_for_new_user(self):
'''Test the contents of a new user's dashboard activity stream.'''
activities = self.dashboard_activity_list(self.new_user)
# We expect to find a single 'new user' activity.
assert len(activities) == 1
assert len(activities) == 1, activities
activity = activities[0]
assert activity['activity_type'] == 'new user'
assert activity['user_id'] == activity['object_id']
Expand Down Expand Up @@ -330,7 +330,7 @@ def test_09_activities_that_should_not_show(self):

after = self.dashboard_activity_list(self.new_user)

assert before == after
assert before == after, (before, after)

def test_10_dashboard_activity_list_html_does_not_crash(self):

Expand Down

0 comments on commit db7a5ce

Please sign in to comment.