Esempio n. 1
0
 def setUp(self):
     imgFile = get_test_image_file()
     imgFile.name = "logo.png"
     self.img = Image.objects.create(title="Logo", file=imgFile)
     imgName = os.path.splitext(os.path.basename(self.img.file.name))[0]
     self.rendName = "{}.width-350.format-png.png".format(imgName)
     Site.objects.update(hostname="joy.test")
     self.home = Page.objects.get(slug='home')
     self.user = User.objects.create_user('i', '*****@*****.**', 's3(R3t')
     self.requestFactory = RequestFactory()
     self.calendar = CalendarPage(owner = self.user,
                                  slug  = "events",
                                  title = "Events")
     self.home.add_child(instance=self.calendar)
     self.calendar.save_revision().publish()
     self.event = RecurringEventPage(owner = self.user,
                                     slug  = "workshop",
                                     title = "Workshop",
                                     image = self.img,
                                     repeat    = Recurrence(dtstart=dt.date(2017,1,1),
                                                            freq=MONTHLY,
                                                            byweekday=[TU(1)],
                                                            until=dt.date(2017,12,26)))
     self.calendar.add_child(instance=self.event)
     self.event.save_revision().publish()
     self.handler = RssHandler()
    def setUp(self):
        if WagtailVersion > (2, 13, 0):
            self.FIELD_CONTENT = """
<div data-contentpath="num_days">
    {}
    {}
</div>
""".format(self.FIELDSET_CONTENT, self.COMMENT_CONTROL_CONTENT)
        else:
            self.FIELD_CONTENT = self.FIELDSET_CONTENT
        self.maxDiff = None
        self.home = getPage("/home/")
        self.user = User.objects.create_superuser('i', '*****@*****.**', 's3(r3t')
        self.calendar = CalendarPage(owner=self.user,
                                     slug="events",
                                     title="Events")
        self.home.add_child(instance=self.calendar)
        self.calendar.save_revision().publish()
        self.event = RecurringEventPage(slug="leaders-meeting",
                                        title="Leaders' Meeting",
                                        repeat=Recurrence(dtstart=dt.date(
                                            2016, 2, 16),
                                                          freq=MONTHLY,
                                                          byweekday=[TU(3)]),
                                        time_from=dt.time(19),
                                        tz="Asia/Tokyo")
        self.calendar.add_child(instance=self.event)
        self.event.save_revision().publish()
        Form = get_form_for_model(RecurringEventPage,
                                  form_class=RecurringEventPageForm)
        self.form = Form(instance=self.event, parent_page=self.calendar)
Esempio n. 3
0
 def testSameTuesdayValue(self):
     widget = RecurrenceWidget()
     data = {
         'repeat_0': '2010-01-12',
         'repeat_1': '1',
         'repeat_2': '1',
         'repeat_6': '101',
         'repeat_7': '1',
         'repeat_8': None,
         'repeat_9': None,
         'repeat_10': None,
         'repeat_11': None
     }
     rr = Recurrence(dtstart=dt.date(2010, 1, 12),
                     freq=MONTHLY,
                     byweekday=[TU(2)])
     self.assertEqual(widget.value_from_datadict(data, {}, 'repeat'), rr)
Esempio n. 4
0
 def setUp(self):
     self.home = getPage("/home/")
     self.user = User.objects.create_superuser('i', '*****@*****.**', 's3(r3t')
     self.calendar = CalendarPage(owner = self.user,
                                  slug  = "events",
                                  title = "Events")
     self.home.add_child(instance=self.calendar)
     self.calendar.save_revision().publish()
     self.event = RecurringEventPage(slug      = "leaders-meeting",
                                     title     = "Leaders' Meeting",
                                     repeat    = Recurrence(dtstart=dt.date(2016,2,16),
                                                            freq=MONTHLY,
                                                            byweekday=[TU(3)]),
                                     time_from = dt.time(19),
                                     tz        = "Asia/Tokyo")
     self.calendar.add_child(instance=self.event)
     self.event.save_revision().publish()
 def setUp(self):
     self.user = User.objects.create_user('i', '*****@*****.**', 's3cr3t')
     self.calendar = CalendarPage(owner = self.user,
                                  slug  = "events",
                                  title = "Events")
     Page.objects.get(slug='home').add_child(instance=self.calendar)
     self.calendar.save()
     self.calendar.save_revision().publish()
     self.event = RecurringEventPage(owner = self.user,
                                     slug  = "lug-meetup",
                                     title = "Linux Users Group Meetup",
                                     repeat = Recurrence(dtstart=dt.date(2017,8,5),
                                                         freq=MONTHLY,
                                                         byweekday=[TU(1)]),
                                     time_from = dt.time(18,30),
                                     time_to   = dt.time(20),
                                     location  = "6 Mackay St, Greymouth (upstairs)")
     self.calendar.add_child(instance=self.event)
     self.event.save_revision().publish()