-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
246 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ htmlcov/ | |
.DS_Store | ||
/.settings/* | ||
|
||
src/brasil/gov/agenda/static/* | ||
src/brasil/gov/agenda/browser/static/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
from brasil.gov.agenda.testing import INTEGRATION_TESTING | ||
from lxml import etree # nosec | ||
from Products.Five.browser import BrowserView | ||
from zope.component import getMultiAdapter | ||
from zope.viewlet.interfaces import IViewletManager | ||
|
||
import unittest | ||
|
||
|
||
class ResourcesViewletTestCase(unittest.TestCase): | ||
|
||
layer = INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
self.request = self.layer['request'] | ||
|
||
self.viewlet = self.get_viewlet(self.portal) | ||
|
||
def get_viewlet_manager(self, context, name='plone.htmlhead'): | ||
request = self.request | ||
view = BrowserView(context, request) | ||
manager = getMultiAdapter( | ||
(context, request, view), IViewletManager, name) | ||
return manager | ||
|
||
def get_viewlet(self, context, name='brasil.gov.agenda.resources'): | ||
manager = self.get_viewlet_manager(context) | ||
manager.update() | ||
viewlet = [v for v in manager.viewlets if v.__name__ == name] | ||
assert len(viewlet) == 1 # nosec | ||
return viewlet[0] | ||
|
||
def test_viewlet(self): | ||
html = etree.HTML(self.viewlet()) | ||
self.assertIn('defer', html.xpath('//script')[0].attrib) | ||
# script name must include the hash of latest git commit | ||
regexp = r'brasilgovagenda-[\da-f]{7}\.js$' | ||
self.assertRegexpMatches( | ||
html.xpath('//script')[0].attrib['src'], regexp) | ||
regexp = r'brasilgovagenda-[\da-f]{7}\.css$' | ||
self.assertRegexpMatches( | ||
html.xpath('//link')[0].attrib['href'], regexp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.