Skip to content

Commit

Permalink
remove tests relating to deprecated portal_css and portal_javascripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem authored and bloodbare committed Oct 9, 2014
1 parent 383e0cb commit d45bd26
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 122 deletions.
15 changes: 0 additions & 15 deletions plone/app/caching/tests/test_integration.py
Expand Up @@ -128,16 +128,6 @@ def test_disabled(self):
OFS.Image.manage_addImage(self.portal['portal_skins']['custom'],
'test.gif', open(TEST_IMAGE, 'rb'))

# Resource registries resource
css_tool = self.portal['portal_css']
# Cook resources to update bundles for theme.
css_tool.cookResources()

# Pass active skin for correct bundles.
active_theme = self.portal['portal_skins'].default_skin
resources = css_tool.getEvaluatedResources(self.portal, active_theme)
cssResourcePath = resources[0].getId()

setRoles(self.portal, TEST_USER_ID, ('Member',))

import transaction
Expand Down Expand Up @@ -171,11 +161,6 @@ def test_disabled(self):
# Set by resources themselves, but irrelevant to this test:
# self.assertTrue('Cache-Control' in browser.headers)

browser.open(self.portal.absolute_url() +
'/portal_css/' + cssResourcePath)
# Set by ResourceRegistries, btu irrelevant ot this test
# self.assertTrue('Cache-Control' in browser.headers)

def test_gzip_setting(self):
self.cacheSettings.enabled = True

Expand Down
54 changes: 0 additions & 54 deletions plone/app/caching/tests/test_profile_with_caching_proxy.py
Expand Up @@ -72,7 +72,6 @@ def setUp(self):

test_css = FSFile('test.css', os.path.join(os.path.dirname(__file__), 'test.css'))
self.portal.portal_skins.custom._setOb('test.css', test_css)
self.portal.portal_css.registerStylesheet('test.css')

setRequest(self.portal.REQUEST)

Expand Down Expand Up @@ -478,56 +477,3 @@ def test_stable_resources(self):
# What is the best way to test this?
# Maybe not important since the RR test exercises the same code?
pass

def test_stable_resources_resource_registries(self):

cssregistry = self.portal.portal_css
skins_tool = self.portal.portal_skins
# Cook resources to update bundles for theme.
cssregistry.cookResources()
import transaction; transaction.commit()

# This is a clone of the same test for 'without-caching-proxy'
# Can we just call that test from this context?

# Request a ResourceRegistry resource
path = cssregistry.absolute_url() + '/' + urllib.quote(skins_tool.default_skin) + "/test.css"
now = stable_now()
browser = Browser(self.app)
browser.open(path)
self.assertEqual('plone.stableResource', browser.headers['X-Cache-Rule'])
self.assertEqual('plone.app.caching.strongCaching', browser.headers['X-Cache-Operation'])
# This should use cacheInBrowserAndProxy
self.assertEqual('max-age=31536000, proxy-revalidate, public', browser.headers['Cache-Control'])
self.assertFalse(None == browser.headers.get('Last-Modified'))
timedelta = dateutil.parser.parse(browser.headers['Expires']) - now
self.assertTrue(timedelta > datetime.timedelta(seconds=31535990))

# Request the ResourceRegistry resource again -- with IMS header to test 304
lastmodified = browser.headers['Last-Modified']
browser = Browser(self.app)
browser.raiseHttpErrors = False
browser.addHeader('If-Modified-Since', lastmodified)
browser.open(path)
self.assertEqual('plone.stableResource', browser.headers['X-Cache-Rule'])
self.assertEqual('plone.app.caching.strongCaching', browser.headers['X-Cache-Operation'])
self.assertEqual('304 Not Modified', browser.headers['Status'])
self.assertEqual('', browser.contents)
self.assertEqual(None, browser.headers.get('Last-Modified'))
self.assertEqual(None, browser.headers.get('Expires'))
self.assertEqual(None, browser.headers.get('Cache-Control'))

# Request the ResourceRegistry resource -- with RR in debug mode
now = stable_now()
cssregistry.setDebugMode(True)

transaction.commit()

browser = Browser(self.app)
browser.open(path)
self.assertEqual('plone.stableResource', browser.headers['X-Cache-Rule'])
self.assertEqual('plone.app.caching.strongCaching', browser.headers['X-Cache-Operation'])
# This should use doNotCache
self.assertEqual('max-age=0, must-revalidate, private', browser.headers['Cache-Control'])
self.assertEqual(None, browser.headers.get('Last-Modified'))
self.assertTrue(now > dateutil.parser.parse(browser.headers['Expires']))
53 changes: 0 additions & 53 deletions plone/app/caching/tests/test_profile_without_caching_proxy.py
Expand Up @@ -70,7 +70,6 @@ def setUp(self):

test_css = FSFile('test.css', os.path.join(os.path.dirname(__file__), 'test.css'))
self.portal.portal_skins.custom._setOb('test.css', test_css)
self.portal.portal_css.registerStylesheet('test.css')

setRequest(self.portal.REQUEST)

Expand Down Expand Up @@ -435,55 +434,3 @@ def test_stable_resources(self):
# What is the best way to test this?
# Maybe not important since the RR test exercises the same code?
pass

def test_stable_resources_resource_registries(self):

# Request a ResourceRegistry resource
cssregistry = self.portal.portal_css
default_skin = self.portal.portal_skins.default_skin
path = cssregistry.absolute_url() + '/' + urllib.quote(default_skin) + "/test.css"
cssregistry.setDebugMode(False)
# Cook resources to update bundles for theme.
cssregistry.cookResources()

import transaction; transaction.commit()

now = stable_now()
browser = Browser(self.app)
browser.open(path)
self.assertEqual('plone.stableResource', browser.headers['X-Cache-Rule'])
self.assertEqual('plone.app.caching.strongCaching', browser.headers['X-Cache-Operation'])
# This should use cacheInBrowserAndProxy
self.assertEqual('max-age=31536000, proxy-revalidate, public', browser.headers['Cache-Control'])
self.assertFalse(None == browser.headers.get('Last-Modified'))
timedelta = dateutil.parser.parse(browser.headers['Expires']) - now
self.assertTrue(timedelta > datetime.timedelta(seconds=31535990))

# Request the ResourceRegistry resource again -- with IMS header to test 304
lastmodified = browser.headers['Last-Modified']
browser = Browser(self.app)
browser.raiseHttpErrors = False
browser.addHeader('If-Modified-Since', lastmodified)
browser.open(path)
self.assertEqual('plone.stableResource', browser.headers['X-Cache-Rule'])
self.assertEqual('plone.app.caching.strongCaching', browser.headers['X-Cache-Operation'])
self.assertEqual('304 Not Modified', browser.headers['Status'])
self.assertEqual('', browser.contents)
self.assertEqual(None, browser.headers.get('Last-Modified'))
self.assertEqual(None, browser.headers.get('Expires'))
self.assertEqual(None, browser.headers.get('Cache-Control'))

# Request the ResourceRegistry resource -- with RR in debug mode
now = stable_now()
cssregistry.setDebugMode(True)

import transaction; transaction.commit()

browser = Browser(self.app)
browser.open(path)
self.assertEqual('plone.stableResource', browser.headers['X-Cache-Rule'])
self.assertEqual('plone.app.caching.strongCaching', browser.headers['X-Cache-Operation'])
# This should use doNotCache
self.assertEqual('max-age=0, must-revalidate, private', browser.headers['Cache-Control'])
self.assertEqual(None, browser.headers.get('Last-Modified'))
self.assertTrue(now > dateutil.parser.parse(browser.headers['Expires']))

1 comment on commit d45bd26

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS PASSED
Mr.Roboto url : http://jenkins.plone.org/roboto/get_info?push=e0117c0a64d44f4e89590885295c1200
[SUCCESS] kgs-plone.app.caching-plone-5.0-python-2.7 kgs

Please sign in to comment.