Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(13)  |  Call(11)  |  Derive(0)  |  Import(2)

src/f/t/ftw.contentpage-1.6.5/ftw/contentpage/tests/test_news_portlets_functional.py   ftw.contentpage(Download)
from ftw.contentpage.portlets.news_archive_portlet import Renderer
from ftw.contentpage.portlets.news_portlet import Assignment as NewsAssignment
from ftw.contentpage.portlets.news_portlet import Renderer as NewsRenderer
from ftw.contentpage.testing import FTW_CONTENTPAGE_FUNCTIONAL_TESTING
from plone.app.testing import TEST_USER_NAME, TEST_USER_PASSWORD
    def test_days_no_filter(self):
        context = self.portal
        portlet = NewsAssignment(days=0, only_context=False)
        manager = getUtility(IPortletManager, name=u"plone.leftcolumn")
        renderer = NewsRenderer(context, context.REQUEST, BrowserView,
    def test_days_filter(self):
        context = self.portal
        portlet = NewsAssignment(days=5, only_context=False)
        manager = getUtility(IPortletManager, name=u"plone.leftcolumn")
        renderer = NewsRenderer(context, context.REQUEST, BrowserView,
 
        portlet = NewsAssignment(days=28, only_context=False)
        renderer = NewsRenderer(context, context.REQUEST, BrowserView,
                                manager, portlet)
        self.assertEquals(len(renderer.get_news()), 3, 'Expect 3 news')
    def test_newsportlet_more_news_link_disabled(self):
        manager = getUtility(IPortletManager, name=u"plone.leftcolumn")
        portlet = NewsAssignment()
        renderer = NewsRenderer(self.portal, self.portal.REQUEST, object(),
                            manager, portlet)

src/f/t/ftw.contentpage-1.6.5/ftw/contentpage/tests/test_news_portlets.py   ftw.contentpage(Download)
from ftw.testing import MockTestCase
from ftw.contentpage.portlets.news_portlet import Assignment, Renderer
from mocker import MATCH
 
 
        self.replay()
        obj = Assignment(path=['/peter/hans'])
        renderer = Renderer(context, request, view, manager, obj)
        renderer.get_news()
 
        self.replay()
        obj = Assignment(path=['peter/hans'], only_context=False)
        renderer = Renderer(context, request, view, manager, obj)
        renderer.get_news()
 
        self.replay()
        obj = Assignment(subjects=['hans', 'peter'], only_context=False)
        renderer = Renderer(context, request, view, manager, obj)
        renderer.get_news()
 
        obj = Assignment(classification_items=['hans/peter'],
                         only_context=False)
        renderer = Renderer(context, request, view, manager, obj)
        renderer.get_news()