Esempio n. 1
0
    def setUp(self):
        import datetime
        from zope.interface import directlyProvides
        from karl.content.interfaces import IBlogEntry

        cleanUp()
        karltesting.registerSettings()

        # Create dummy site skel
        community = karltesting.DummyCommunity()
        site = community.__parent__.__parent__

        profiles = testing.DummyModel()
        site["profiles"] = profiles
        self.profile = profiles["member"] = karltesting.DummyProfile()
        profiles["creator"] = karltesting.DummyProfile()

        community["blog"] = testing.DummyModel()

        blogentry = testing.DummyModel(text="This is a test")
        blogentry.created = datetime.datetime(2010, 5, 12, 2, 42)
        blogentry.creator = 'member'
        community["blog"]["blogentry"] = blogentry
        blogentry["attachments"] = testing.DummyModel()
        blogentry.title = "Blog Entry"
        blogentry.docid = 0
        directlyProvides(blogentry, IBlogEntry)
        self.blogentry = blogentry

        blogentry["comments"] = testing.DummyModel()
        self.comment = self._add_comment(blogentry)
Esempio n. 2
0
    def setUp(self):
        from zope.interface import directlyProvides
        from karl.content.interfaces import ICommunityFile

        config = cleanUp()
        config.setup_registry()  # this is not a unit test

        karltesting.registerSettings()

        # Create dummy site skel
        community = karltesting.DummyCommunity()
        site = community.__parent__.__parent__

        profiles = testing.DummyModel()
        site["profiles"] = profiles
        self.profile = profiles["member"] = karltesting.DummyProfile()
        profiles["creator"] = karltesting.DummyProfile()

        community["files"] = testing.DummyModel()

        f = testing.DummyModel(text="This is a test",
                               description="Some description")
        community["files"]["file"] = f
        f.title = "An interesting file"
        f.docid = 0
        directlyProvides(f, ICommunityFile)
        self.f = f
        f.creator = "creator"
Esempio n. 3
0
    def setUp(self):
        from zope.interface import directlyProvides
        from karl.content.interfaces import IBlogEntry

        config = cleanUp()
        config.setup_registry()  # this is not a unit test

        karltesting.registerSettings()

        # Create dummy site skel
        self.community = community = karltesting.DummyCommunity()
        site = community.__parent__.__parent__

        profiles = testing.DummyModel()
        site["profiles"] = profiles
        self.profile = profiles["member"] = karltesting.DummyProfile()
        profiles["creator"] = karltesting.DummyProfile()

        community["blog"] = testing.DummyModel()

        blogentry = testing.DummyModel(text="This is a test")
        community["blog"]["blogentry"] = blogentry
        blogentry["attachments"] = testing.DummyModel()
        blogentry.title = "Blog Entry"
        blogentry.docid = 0
        directlyProvides(blogentry, IBlogEntry)
        self.blogentry = blogentry
        blogentry.creator = "creator"
Esempio n. 4
0
    def test_submit_form(self):
        from repoze.sendmail.interfaces import IMailDelivery
        karltesting.registerDummyRenderer("templates/join_community.pt")

        c = karltesting.DummyCommunity()
        c.moderator_names = set(["moderator1", "moderator2"])
        site = c.__parent__.__parent__
        profiles = site["profiles"] = testing.DummyModel()
        profiles["user"] = karltesting.DummyProfile()
        profiles["moderator1"] = karltesting.DummyProfile()
        profiles["moderator2"] = karltesting.DummyProfile()

        mailer = karltesting.DummyMailer()
        karltesting.registerUtility(mailer, IMailDelivery)

        karltesting.registerDummySecurityPolicy("user")
        request = testing.DummyRequest({
            "form.submitted": "1",
            "message": "Message text.",
        })
        karltesting.registerDummyRenderer(
            'karl.views:templates/email_join_community.pt')
        response = self._callFUT(c, request)

        self.assertEqual(response.location,
                         "http://example.com/communities/community/"
                         "?status_message=Your+request+has+been+sent+"
                         "to+the+moderators.")
        self.assertEqual(len(mailer), 1)
        msg = mailer.pop()
        self.assertEqual(msg.mto, ["*****@*****.**",
                                   "*****@*****.**"])
Esempio n. 5
0
 def test_show_form(self):
     c = karltesting.DummyCommunity()
     site = c.__parent__.__parent__
     profiles = site["profiles"] = testing.DummyModel()
     profiles["user"] = karltesting.DummyProfile()
     karltesting.registerDummySecurityPolicy("user")
     request = testing.DummyRequest()
     response = self._callFUT(c, request)
     self.assertEqual(response['profile'], profiles["user"])
     self.assertEqual(response['community'], c)
     self.assertEqual(response['post_url'],
                      "http://example.com/communities/community/join.html")
Esempio n. 6
0
    def setUp(self):
        from zope.interface import directlyProvides
        from karl.content.interfaces import ICalendarEvent

        config = cleanUp()
        config.setup_registry()  # this is not a unit test

        karltesting.registerSettings()
        karltesting.registerKarlDates()

        # Create dummy site skel
        community = karltesting.DummyCommunity()
        site = community.__parent__.__parent__

        profiles = testing.DummyModel()
        site["profiles"] = profiles
        self.profile = profiles["member"] = karltesting.DummyProfile()
        profiles["creator"] = karltesting.DummyProfile()

        community["calendar"] = testing.DummyModel()

        event = testing.DummyModel(
            text="This is a test",
            description="Some description",
            startDate=datetime(2009, 8, 5, 10, 0),
            endDate=datetime(2009, 8, 5, 11, 0),
            attendees=['alice', 'bob'],
            location='NYC',
            contact_name='Alice W',
            contact_email='*****@*****.**',
        )
        community["calendar"]["event"] = event
        event.title = "An Exciting Event!"
        event.docid = 0
        directlyProvides(event, ICalendarEvent)
        self.event = event
        event.creator = "creator"
Esempio n. 7
0
 def __init__(self):
     testing.DummyModel.__init__(self)
     self.__parent__ = karltesting.DummyCommunity()
     self.__name__ = 'members'