Skip to content

Commit

Permalink
Fix upgrade step and tests for Twitter Bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Oct 9, 2013
1 parent 7d7d383 commit fa541e2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions src/collective/cover/tests/test_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,25 +355,25 @@ def test_issue_201(self):
self.assertIsNotNone(step)
self.assertEqual(step['description'], description)

# run the upgrade step to validate the update
self._do_upgrade_step(step)

css_tool = self.portal['portal_css']
js_tool = self.portal['portal_javascripts']
old_css = '++resource++collective.cover/bootstrap.min.css'
new_css = '++resource++collective.js.bootstrap/css/bootstrap.min.css'
old_js = '++resource++collective.cover/bootstrap.min.js'
new_js = '++resource++collective.js.bootstrap/js/bootstrap.min.js'

# simulate state on previous version
css_tool.renameResource(new_css, old_css)
js_tool.renameResource(new_js, old_js)
self.assertIn(old_css, css_tool.getResourceIds())
self.assertNotIn(new_css, css_tool.getResourceIds())
self.assertIn(old_js, js_tool.getResourceIds())
self.assertNotIn(new_js, js_tool.getResourceIds())

self.assertNotIn(
'++resource++collective.cover/bootstrap.min.css',
css_tool.getResourceIds()
)
self.assertNotIn(
'++resource++collective.cover/bootstrap.min.js',
js_tool.getResourceIds()
)
self.assertIn(
'++resource++collective.js.bootstrap/css/bootstrap.min.css',
css_tool.getResourceIds()
)
self.assertIn(
'++resource++collective.js.bootstrap/js/bootstrap.min.js',
js_tool.getResourceIds()
)
# run the upgrade step to validate the update
self._do_upgrade_step(step)

self.assertNotIn(old_css, css_tool.getResourceIds())
self.assertIn(new_css, css_tool.getResourceIds())
self.assertNotIn(old_js, js_tool.getResourceIds())
self.assertIn(new_js, js_tool.getResourceIds())
4 changes: 2 additions & 2 deletions src/collective/cover/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def issue_201(context, logger=None):
# first we take care of the CSS registry
css_tool = getToolByName(context, 'portal_css')
old_id = '++resource++collective.cover/bootstrap.min.css'
new_id = '++resource++collective.js.bootstrap/bootstrap.min.css'
new_id = '++resource++collective.js.bootstrap/css/bootstrap.min.css'
if old_id in css_tool.getResourceIds():
css_tool.renameResource(old_id, new_id)
logger.info("'{0}' resource was renamed to '{1}'".format(old_id, new_id))
Expand All @@ -269,7 +269,7 @@ def issue_201(context, logger=None):
# now we mess with the JS registry
js_tool = getToolByName(context, 'portal_javascripts')
old_id = '++resource++collective.cover/bootstrap.min.js'
new_id = '++resource++collective.js.bootstrap/bootstrap.min.js'
new_id = '++resource++collective.js.bootstrap/js/bootstrap.min.js'
if old_id in js_tool.getResourceIds():
js_tool.renameResource(old_id, new_id)
logger.info("'{0}' resource was renamed to '{1}'".format(old_id, new_id))
Expand Down

0 comments on commit fa541e2

Please sign in to comment.