Skip to content

Commit

Permalink
Replace assertions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Jun 14, 2018
1 parent e507708 commit 73602a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/collective/liveblog/tests/test_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ def test_registered_steps(self):
def test_remove_workflow(self):
title = u'Migrate liveblog workflow'
step = self._get_upgrade_step_by_title(title)
assert step is not None
self.assertIsNotNone(step)

# simulate (partially) state on previous version
wtool = api.portal.get_tool('portal_workflow')
wtool.setChainForPortalTypes(('Liveblog',), ('liveblog_workflow',))
assert wtool.getChainForPortalType('Liveblog') == ('liveblog_workflow',)
self.assertEqual(
wtool.getChainForPortalType('Liveblog'), ('liveblog_workflow',))

# execute upgrade step and verify changes were applied
self._do_upgrade(step)
Expand All @@ -79,14 +80,14 @@ def test_remove_workflow(self):
def test_make_liveblog_linkable(self):
title = u'Make Liveblog linkable on TinyMCE'
step = self._get_upgrade_step_by_title(title)
assert step is not None
self.assertIsNotNone(step)

# simulate state on previous version
tinymce = api.portal.get_tool('portal_tinymce')
linkable = tinymce.linkable.split('\n')
linkable.remove('Liveblog')
tinymce.linkable = '\n'.join(linkable)
assert 'Liveblog' not in tinymce.linkable.split('\n')
self.assertNotIn('Liveblog', tinymce.linkable.split('\n'))

# execute upgrade step and verify changes were applied
self._do_upgrade(step)
Expand Down
5 changes: 3 additions & 2 deletions src/collective/liveblog/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ def test_needs_hard_refresh_on_deletion(self):
def test_not_modified(self):
RFC1123 = '%a, %d %b %Y %H:%M:%S GMT'
# calling the method without header will return False
assert not self.request.get_header('If-Modified-Since')
self.assertFalse(self.request.get_header('If-Modified-Since'))
self.assertFalse(self.view._not_modified())
# invalid date return False
self.request.environ['IF_MODIFIED_SINCE'] = 'invalid'
assert self.request.get_header('If-Modified-Since') == 'invalid'
self.assertEqual(
self.request.get_header('If-Modified-Since'), 'invalid')
self.assertFalse(self.view._not_modified())
# modified, return False as we must update
if_modified_since = datetime.utcnow() - timedelta(seconds=60)
Expand Down

0 comments on commit 73602a0

Please sign in to comment.