def test_subfloor_gets_own_utility(self):
        enable_party(self.dancefloor)
        enable_party(self.subfloor)

        self.assertEqual(len(component.getAllUtilitiesRegisteredFor(IChannelLookup)), 2)

        hooks.setSite(self.subfloor)

        name = get_name_for_site(self.dancefloor)
        util1 = component.getUtility(ILocalNewsletterLookup, name=name)
        self.failUnless(isinstance(util1, LocalNewsletterLookup))

        name = get_name_for_site(self.subfloor)
        util2 = component.getUtility(ILocalNewsletterLookup, name=name)
        self.failUnless(isinstance(util2, LocalNewsletterLookup))

        self.failUnless(util2 is not util1)
예제 #2
0
    def test_subfloor_gets_own_utility(self):
        enable_party(self.dancefloor)
        enable_party(self.subfloor)

        self.assertEqual(
            len(component.getAllUtilitiesRegisteredFor(IChannelLookup)), 2)

        hooks.setSite(self.subfloor)

        name = get_name_for_site(self.dancefloor)
        util1 = component.getUtility(ILocalNewsletterLookup, name=name)
        self.failUnless(isinstance(util1, LocalNewsletterLookup))

        name = get_name_for_site(self.subfloor)
        util2 = component.getUtility(ILocalNewsletterLookup, name=name)
        self.failUnless(isinstance(util2, LocalNewsletterLookup))

        self.failUnless(util2 is not util1)
    def test_enable_party(self):

        dancefloor = self.dancefloor
        self.assertEqual(len(component.getAllUtilitiesRegisteredFor(IChannelLookup)), 2)

        enable_party(dancefloor)

        # setSite() needed in tests due to traversal adapter not called
        hooks.setSite(dancefloor)

        # we still have the same number if IChannelLookup utitities
        self.assertEqual(len(component.getAllUtilitiesRegisteredFor(IChannelLookup)), 2)

        # ... but now we have a ILocalNewsletterLookup named after the site
        # registered
        name = get_name_for_site(dancefloor)
        self.assertEqual(name, "plone.Members.test_user_1_.dancefloor")
        util = component.getUtility(ILocalNewsletterLookup, name=name)
        self.failUnless(isinstance(util, LocalNewsletterLookup))
예제 #4
0
    def afterSetUp(self):
        _ = self.folder.invokeFactory("Folder", "dancefloor")
        self.dancefloor = self.folder.get(_)
        _ = self.dancefloor.invokeFactory("Folder", "subfloor")
        self.subfloor = self.dancefloor.get(_)
        enable_party(self.dancefloor)
        enable_party(self.subfloor)
        self.add_channel(self.dancefloor, "df_channel1")
        self.add_channel(self.dancefloor, "df_channel2")
        self.add_channel(self.subfloor, "sf_channel1")
        self.add_channel(self.subfloor, "sf_channel2")

        self.add_collector(self.dancefloor, "df_collector1")
        self.add_collector(self.dancefloor, "df_collector2")
        self.add_collector(self.subfloor, "sf_collector1")
        self.add_collector(self.subfloor, "sf_collector2")

        from collective.dancing.channel import PortalNewsletters, tool_added
        news = PortalNewsletters("portal_newsletters")
        self.portal["portal_newsletters"] = news
        tool_added(news, None)
예제 #5
0
    def test_enable_party(self):

        dancefloor = self.dancefloor
        self.assertEqual(
            len(component.getAllUtilitiesRegisteredFor(IChannelLookup)), 2)

        enable_party(dancefloor)

        # setSite() needed in tests due to traversal adapter not called
        hooks.setSite(dancefloor)

        # we still have the same number if IChannelLookup utitities
        self.assertEqual(
            len(component.getAllUtilitiesRegisteredFor(IChannelLookup)), 2)

        # ... but now we have a ILocalNewsletterLookup named after the site
        # registered
        name = get_name_for_site(dancefloor)
        self.assertEqual(name, "plone.Members.test_user_1_.dancefloor")
        util = component.getUtility(ILocalNewsletterLookup, name=name)
        self.failUnless(isinstance(util, LocalNewsletterLookup))
    def afterSetUp(self):
        _ = self.folder.invokeFactory("Folder", "dancefloor")
        self.dancefloor = self.folder.get(_)
        _ = self.dancefloor.invokeFactory("Folder", "subfloor")
        self.subfloor = self.dancefloor.get(_)
        enable_party(self.dancefloor)
        enable_party(self.subfloor)
        self.add_channel(self.dancefloor, "df_channel1")
        self.add_channel(self.dancefloor, "df_channel2")
        self.add_channel(self.subfloor, "sf_channel1")
        self.add_channel(self.subfloor, "sf_channel2")

        self.add_collector(self.dancefloor, "df_collector1")
        self.add_collector(self.dancefloor, "df_collector2")
        self.add_collector(self.subfloor, "sf_collector1")
        self.add_collector(self.subfloor, "sf_collector2")

        from collective.dancing.channel import PortalNewsletters, tool_added

        news = PortalNewsletters("portal_newsletters")
        self.portal["portal_newsletters"] = news
        tool_added(news, None)