Пример #1
0
    def test_get_last_meeting(self):
        create(Builder('meeting')
               .having(committee=self.committee,
                       start=localized_datetime(2015, 01, 01)))
        meeting = create(Builder('meeting')
                         .having(committee=self.committee,
                                 start=localized_datetime(2015, 01, 07)))
        create(Builder('meeting')
               .having(committee=self.committee,
                       start=localized_datetime(2015, 01, 15)))

        with freeze(localized_datetime(2015, 01, 10)):
            self.assertEquals(meeting,
                              Meeting.query.get_last_meeting(self.committee))
Пример #2
0
    def test_all_upcoming_meetings_returns_only_future_meetings(self):
        create(Builder('meeting').having(committee=self.committee,
                                         start=localized_datetime(2015, 01, 01)))
        meeting_1 = create(Builder('meeting')
                           .having(committee=self.committee,
                                   start=localized_datetime(2015, 01, 10)))
        meeting_2 = create(Builder('meeting')
                           .having(committee=self.committee,
                                   start=localized_datetime(2015, 01, 15)))

        with freeze(localized_datetime(2015, 01, 10)):
            self.assertEquals(
                [meeting_1, meeting_2],
                Meeting.query.all_upcoming_meetings(self.committee))
Пример #3
0
    def test_all_upcoming_meetings_is_limited_by_committee(self):
        committee_2 = create(Builder('committee_model').having(int_id=5678))

        meeting1 = create(Builder('meeting')
                          .having(committee=self.committee,
                                  start=localized_datetime() + timedelta(hours=1)))
        meeting2 = create(Builder('meeting')
                          .having(committee=self.committee,
                                  start=localized_datetime() + timedelta(hours=1)))
        create(Builder('meeting')
               .having(committee=committee_2,
                       start=localized_datetime() + timedelta(hours=1)))

        self.assertEquals([meeting1, meeting2],
                          Meeting.query.all_upcoming_meetings(self.committee))
    def test_all_upcoming_meetings_is_limited_by_committee(self):
        committee_2 = create(Builder('committee_model').having(int_id=5678))

        meeting1 = create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime() +
                                      timedelta(hours=1)))
        meeting2 = create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime() +
                                      timedelta(hours=1)))
        create(
            Builder('meeting').having(committee=committee_2,
                                      start=localized_datetime() +
                                      timedelta(hours=1)))

        self.assertEquals([meeting1, meeting2],
                          Meeting.query.all_upcoming_meetings(self.committee))
Пример #5
0
    def test_by_meeting(self):
        self.setup_membership(date(2004, 1, 20), date(2010, 1, 19))
        active = self.setup_membership(date(2010, 1, 20), date(2013, 7, 21))
        self.setup_membership(date(2013, 7, 22), date(2016, 1, 1))

        meeting = create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime(2010, 1, 29),
                                      end=None))

        self.assertEqual([active], Membership.query.for_meeting(meeting).all())
    def test_by_meeting(self):
        self.setup_membership(date(2004, 1, 20), date(2010, 1, 19))
        active = self.setup_membership(date(2010, 1, 20), date(2013, 7, 21))
        self.setup_membership(date(2013, 7, 22), date(2016, 1, 1))

        meeting = create(Builder('meeting').having(
                         committee=self.committee,
                         start=localized_datetime(2010, 1, 29),
                         end=None))

        self.assertEqual([active], Membership.query.for_meeting(meeting).all())
Пример #7
0
    def test_fetch_for_meeting(self):
        meeting = create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime(2014, 7, 1),
                                      end=None))
        create(
            Builder('membership').having(date_from=date(2013, 1, 1),
                                         date_to=date(2013, 12, 31),
                                         member=self.member,
                                         committee=self.committee))
        membership = create(
            Builder('membership').having(date_from=date(2014, 1, 1),
                                         date_to=date(2014, 12, 31),
                                         member=self.member,
                                         committee=self.committee))
        create(
            Builder('membership').having(date_from=date(2015, 1, 1),
                                         date_to=date(2015, 12, 31),
                                         member=self.member,
                                         committee=self.committee))

        self.assertEqual(
            membership,
            Membership.query.fetch_for_meeting(meeting, self.member))
    def test_fetch_for_meeting(self):
        meeting = create(Builder('meeting').having(
                         committee=self.committee,
                         start=localized_datetime(2014, 7, 1),
                         end=None))
        create(Builder('membership').having(
            date_from=date(2013, 1, 1),
            date_to=date(2013, 12, 31),
            member=self.member,
            committee=self.committee))
        membership = create(Builder('membership').having(
            date_from=date(2014, 1, 1),
            date_to=date(2014, 12, 31),
            member=self.member,
            committee=self.committee))
        create(Builder('membership').having(
            date_from=date(2015, 1, 1),
            date_to=date(2015, 12, 31),
            member=self.member,
            committee=self.committee))

        self.assertEqual(
            membership,
            Membership.query.fetch_for_meeting(meeting, self.member))