Exemplo n.º 1
0
 def __init__(self, session):
     super(MeetingBuilder, self).__init__(session)
     self._scheduled_proposals = []
     self.arguments['dossier_admin_unit_id'] = 'foo'
     self.arguments['dossier_int_id'] = 1234
     self.arguments['start'] = localized_datetime(2011, 12, 13, 9, 30)
     self.arguments['end'] = localized_datetime(2011, 12, 13, 11, 45)
     self.arguments['location'] = u'B\xe4rn'
     self.arguments['title'] = u'C\xf6mmunity meeting'
Exemplo n.º 2
0
 def __init__(self, session):
     super(MeetingBuilder, self).__init__(session)
     self._scheduled_proposals = []
     self.arguments['dossier_admin_unit_id'] = 'foo'
     self.arguments['dossier_int_id'] = 1234
     self.arguments['start'] = localized_datetime(2011, 12, 13, 9, 30)
     self.arguments['end'] = localized_datetime(2011, 12, 13, 11, 45)
     self.arguments['location'] = u'B\xe4rn'
     self.arguments['title'] = u'C\xf6mmunity meeting'
    def test_closed_meetings_are_limited_to_ten_entries(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            [create(Builder('meeting')
                    .having(committee=self.committee,
                            start=localized_datetime(2016, 1 ,10) - timedelta(days=i)))
             for i in range(12)]
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        meetings = browser.css('#closed_meetingsBox li:not(.moreLink) a')
        self.assertEquals(10, len(meetings))
Exemplo n.º 4
0
    def test_closed_meetings_are_limited_to_ten_entries(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            [
                create(
                    Builder('meeting').having(
                        committee=self.committee,
                        start=localized_datetime(2016, 1, 10) -
                        timedelta(days=i))) for i in range(12)
            ]
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        meetings = browser.css('#closed_meetingsBox li:not(.moreLink) a')
        self.assertEquals(10, len(meetings))
Exemplo n.º 5
0
    def test_get_for_meeting_returns_active_period_if_possible(self):
        closed_period = create(
            Builder('period').having(workflow_state='closed',
                                     committee=self.committee,
                                     date_from=date(2010, 6, 1),
                                     date_to=date(2011, 12, 31)))
        meeting = create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime(2010, 8, 1)))
        # Both periods match the date and committee of the meeting, but only
        # on is active
        self.assertEqual(self.period, Period.query.get_for_meeting(meeting))

        # Only the closed period matches the meeting date
        meeting.start = localized_datetime(2011, 8, 1)
        self.assertEqual(closed_period, Period.query.get_for_meeting(meeting))
    def test_proposals_are_linked_correctly(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            'http://nohost/plone/opengever-meeting-committeecontainer/committee-1/submitted-proposal-1',
            browser.css('#unscheduled_proposalsBox li a').first.get('href'))
Exemplo n.º 7
0
    def test_member_is_linked_correctly(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            'http://nohost/plone/opengever-meeting-committeecontainer/member-1',
            browser.css('#current_membersBox li a').first.get('href'))
    def test_member_is_linked_correctly(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            'http://nohost/plone/opengever-meeting-committeecontainer/member-1',
            browser.css('#current_membersBox li a').first.get('href'))
    def test_upcoming_meetings_box_only_lists_meetings_in_the_future(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'8. Sitzung der Rechnungspr\xfcfungskommission', u'9. Sitzung der Rechnungspr\xfcfungskommission'],
            browser.css('#upcoming_meetingsBox li:not(.moreLink) a').text)
Exemplo n.º 10
0
    def test_proposals_are_linked_correctly(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            'http://nohost/plone/opengever-meeting-committeecontainer/committee-1/submitted-proposal-1',
            browser.css('#unscheduled_proposalsBox li a').first.get('href'))
    def test_membership_box_shows_only_active_members(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            # create a membership which should not appear
            self.login(self.administrator)
            james = create(Builder('member')
                           .having(firstname=u'James', lastname=u'Bond'))
            create(Builder('membership')
                   .having(member=james,
                           committee=self.committee,
                           date_from=localized_datetime(2014, 1, 1),
                           date_to=localized_datetime(2015, 1, 1)))

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'Sch\xf6ller Heidrun', 'Wendler Jens', u'W\xf6lfl Gerda'],
            browser.css('#current_membersBox li:not(.moreLink)').text)
Exemplo n.º 12
0
    def test_closed_meetings_box_only_lists_meetings_in_the_past(
            self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'7. Sitzung der Rechnungspr\xfcfungskommission'],
            browser.css('#closed_meetingsBox li:not(.moreLink) a').text)
Exemplo n.º 13
0
    def test_get_for_meeting_filters_for_correct_date(self):
        create(
            Builder('period').having(committee=self.committee,
                                     date_from=date(2011, 1, 1),
                                     date_to=date(2011, 12, 31)))

        meeting = create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime(2010, 4, 1)))
        self.assertEqual(self.period, Period.query.get_for_meeting(meeting))
    def test_proposal_box_only_lists_unscheduled_proposals(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'Vertr\xe4ge'],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)

        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            self.schedule_proposal(self.meeting, self.proposal)

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)
    def test_proposal_box_only_lists_unscheduled_proposals(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'Vertr\xe4ge'],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)

        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            self.schedule_proposal(self.meeting, self.proposal)

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)
Exemplo n.º 16
0
    def test_membership_box_shows_only_active_members(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            # create a membership which should not appear
            self.login(self.administrator)
            james = create(
                Builder('member').having(firstname=u'James', lastname=u'Bond'))
            create(
                Builder('membership').having(
                    member=james,
                    committee=self.committee,
                    date_from=localized_datetime(2014, 1, 1),
                    date_to=localized_datetime(2015, 1, 1)))

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'Sch\xf6ller Heidrun', 'Wendler Jens', u'W\xf6lfl Gerda'],
            browser.css('#current_membersBox li:not(.moreLink)').text)
    def test_proposal_box_only_lists_unscheduled_proposals(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'Vertragsentwurf f\xfcr weitere Bearbeitung bewilligen', u'\xc4nderungen am Personalreglement'],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)

        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            self.schedule_proposal(self.meeting, self.proposal)

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'\xc4nderungen am Personalreglement'],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)
Exemplo n.º 18
0
 def test_meeting_data_for_zip_export_json(self):
     self.login(self.committee_responsible)
     self.schedule_paragraph(self.meeting, u'A Gesch\xfcfte')
     with freeze(localized_datetime(2017, 12, 13)):
         self.schedule_ad_hoc(self.meeting, u'Ad-hoc Traktand\xfem')
     self.schedule_proposal(self.meeting, self.submitted_word_proposal)
     self.assertEquals(
         {
             'agenda_items': [{
                 'title': u'A Gesch\xfcfte',
             }, {
                 'number': '1.',
                 'proposal': {
                     'checksum':
                     'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                     'file':
                     u'1. Ad-hoc Traktandthm/Ad hoc agenda item Ad-hoc Traktandthm.docx',
                     'modified': u'2017-12-12T23:00:00+01:00',
                 },
                 'title': u'Ad-hoc Traktand\xfem',
             }, {
                 'attachments': [{
                     'checksum':
                     '51d6317494eccc4a73154625a6820cb6b50dc1455eb4cf26399299d4f9ce77b2',
                     'file':
                     u'2. Anderungen am Personalreglement/Vertragsentwurf.docx',
                     'modified': u'2016-08-31T15:21:46+02:00',
                     'title': u'Vertr\xe4gsentwurf',
                 }],
                 'number':
                 '2.',
                 'proposal': {
                     'checksum':
                     'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                     'file':
                     u'2. Anderungen am Personalreglement/Anderungen am Personalreglement.docx',
                     'modified': u'2016-08-31T15:21:44+02:00',
                 },
                 'title':
                 u'\xc4nderungen am Personalreglement',
             }],
             'committee': {
                 'oguid': u'plone:1009233300',
                 'title': u'Rechnungspr\xfcfungskommission',
             },
             'end':
             u'2016-09-12T17:00:00+00:00',
             'location':
             u'B\xfcren an der Aare',
             'start':
             u'2016-09-12T15:30:00+00:00',
             'title':
             u'9. Sitzung der Rechnungspr\xfcfungskommission',
         }, self.meeting.get_data_for_zip_export())
    def test_meeting_data_for_zip_export_json(self):
        set_preferred_language(self.portal.REQUEST, 'de-ch')
        self.login(self.committee_responsible)
        self.schedule_paragraph(self.meeting, u'A Gesch\xfcfte')
        with freeze(localized_datetime(2017, 12, 13)):
            self.schedule_ad_hoc(self.meeting, u'Ad-hoc Traktand\xfem')
        self.schedule_proposal(self.meeting, self.submitted_proposal)

        serializer = MeetingJSONSerializer(
            self.meeting.model,
            MeetingDocumentZipper(self.meeting.model, None))
        serializer.traverse()
        expected_agenda_items = {
            'agenda_items': [
                {'opengever_id': 2, 'sort_order': 1, 'title': u'A Gesch\xfcfte'},
                {
                    'number': '1.', 'number_raw': 1, 'opengever_id': 3, 'proposal': {
                        'checksum': 'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                        'file': 'Traktandum 1/Ad-hoc Traktandthm.docx',
                        'modified': u'2017-12-13T00:00:00+01:00',
                    },
                    'sort_order': 2,
                    'title': u'Ad-hoc Traktand\xfem'
                },
                {
                    'attachments': [{
                        'checksum': '51d6317494eccc4a73154625a6820cb6b50dc1455eb4cf26399299d4f9ce77b2',
                        'file': 'Traktandum 2/Beilage/1_Vertraegsentwurf.docx',
                        'modified': u'2016-08-31T16:09:37+02:00',
                        'title': u'Vertr\xe4gsentwurf',
                    }],
                    'number': '2.',
                    'number_raw': 2,
                    'opengever_id': 4,
                    'proposal': {
                        'checksum': '114e7a059dc34c7459dab90904685584e331089d80bb6310183a0de009b66c3b',
                        'file': 'Traktandum 2/Vertraege.docx',
                        'modified': u'2016-08-31T16:09:35+02:00',
                    },
                    'sort_order': 3,
                    'title': u'Vertr\xe4ge',
                },
            ],
            'committee': {'oguid': u'plone:1009313300', 'title': u'Rechnungspr\xfcfungskommission'},
            'end': u'2016-09-12T17:00:00+00:00',
            'location': u'B\xfcren an der Aare',
            'opengever_id': 1,
            'start': u'2016-09-12T15:30:00+00:00',
            'title': u'9. Sitzung der Rechnungspr\xfcfungskommission',
        }

        self.assertEquals(expected_agenda_items, serializer.data)
Exemplo n.º 20
0
    def test_proposal_box_only_lists_unscheduled_proposals(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [
                u'Vertragsentwurf f\xfcr weitere Bearbeitung bewilligen',
                u'\xc4nderungen am Personalreglement'
            ],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)

        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            self.schedule_proposal(self.meeting, self.proposal)

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        self.assertEquals(
            [u'\xc4nderungen am Personalreglement'],
            browser.css('#unscheduled_proposalsBox li:not(.moreLink) a').text)
Exemplo n.º 21
0
    def test_add_meeting_and_dossier(self, browser):
        self.login(self.committee_responsible, browser)
        committee_model = self.committee.load_model()
        previous_meetings = len(committee_model.meetings)

        # create meeting
        browser.open(self.committee, view='add-meeting')
        browser.fill({
            'Title': u'M\xe4\xe4hting',
            'Start': '01.01.2010 10:00',
            'End': '01.01.2010 11:00',
            'Location': 'Somewhere',
        }).submit()

        # create dossier
        browser.find('Save').click()

        # back to meeting page
        self.assertEqual(
            [u'The meeting and its dossier were created successfully'],
            info_messages())

        self.assertEqual(
            'http://nohost/plone/opengever-meeting-committeecontainer/committee-1#meetings',
            browser.url)

        committee_model = self.committee.load_model()
        self.assertEqual(previous_meetings + 1, len(committee_model.meetings))
        meeting = committee_model.meetings[-1]

        self.assertEqual(localized_datetime(2010, 1, 1, 10), meeting.start)
        self.assertEqual(localized_datetime(2010, 1, 1, 11), meeting.end)
        self.assertEqual('Somewhere', meeting.location)
        dossier = meeting.dossier_oguid.resolve_object()
        self.assertIsNotNone(dossier)
        self.assertEquals(u'M\xe4\xe4hting', dossier.title)
        self.assertIsNotNone(meeting.modified)
Exemplo n.º 22
0
    def test_add_meeting_and_dossier(self, browser):
        self.login(self.committee_responsible, browser)
        committee_model = self.committee.load_model()
        previous_meetings = len(committee_model.meetings)

        # create meeting
        browser.open(self.committee, view='add-meeting')
        browser.fill({
            'Title': u'M\xe4\xe4hting',
            'Start': '01.01.2010 10:00',
            'End': '01.01.2010 11:00',
            'Location': 'Somewhere',
        }).submit()

        # create dossier
        browser.find('Save').click()

        # back to meeting page
        self.assertEqual(
            [u'The meeting and its dossier were created successfully'],
            info_messages())

        self.assertEqual(
            'http://nohost/plone/opengever-meeting-committeecontainer/committee-1#meetings',
            browser.url)

        committee_model = self.committee.load_model()
        self.assertEqual(previous_meetings + 1, len(committee_model.meetings))
        meeting = committee_model.meetings[-1]

        self.assertEqual(localized_datetime(2010, 1, 1, 10), meeting.start)
        self.assertEqual(localized_datetime(2010, 1, 1, 11), meeting.end)
        self.assertEqual('Somewhere', meeting.location)
        dossier = meeting.dossier_oguid.resolve_object()
        self.assertIsNotNone(dossier)
        self.assertEquals(u'M\xe4\xe4hting', dossier.title)
        self.assertIsNotNone(meeting.modified)
    def test_entries_are_sorted_by_date(self, browser):
        self.login(self.meeting_user, browser)
        browser.open(self.committee, view='tabbedview_view-meetings')
        self.assertEquals(
            ['Jul 17, 2015', 'Sep 12, 2016'],
            browser.css('#listing_container tbody tr td:nth-child(4)').text)

        self.login(self.committee_responsible)
        create(Builder('meeting')
               .having(committee=self.committee,
                       start=localized_datetime(2016, 8, 21)))

        self.login(self.meeting_user, browser)
        browser.open(self.committee, view='tabbedview_view-meetings')
        self.assertEquals(
            ['Jul 17, 2015', 'Aug 21, 2016', 'Sep 12, 2016'],
            browser.css('#listing_container tbody tr td:nth-child(4)').text)
    def test_entries_are_sorted_by_date(self, browser):
        self.login(self.meeting_user, browser)
        browser.open(self.committee, view='tabbedview_view-meetings')
        self.assertEquals(
            ['Jul 17, 2015', 'Sep 12, 2016'],
            browser.css('#listing_container tbody tr td:nth-child(4)').text)

        self.login(self.committee_responsible)
        create(
            Builder('meeting').having(committee=self.committee,
                                      start=localized_datetime(2016, 8, 21)))

        self.login(self.meeting_user, browser)
        browser.open(self.committee, view='tabbedview_view-meetings')
        self.assertEquals(
            ['Jul 17, 2015', 'Aug 21, 2016', 'Sep 12, 2016'],
            browser.css('#listing_container tbody tr td:nth-child(4)').text)
Exemplo n.º 25
0
    def test_membership_shows_members_alphabetically(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            anton = create(
                Builder('member').having(firstname=u'Anton',
                                         lastname=u'Andermatt'))
            lucas = create(
                Builder('member').having(firstname=u'Lucas', lastname=u'Lenz'))
            kevin = create(
                Builder('member').having(firstname=u'Kevin',
                                         lastname=u'Kummermuth'))

            create(
                Builder('membership').having(
                    member=anton,
                    committee=self.committee,
                    date_from=localized_datetime(2016, 1, 1),
                    date_to=localized_datetime(2017, 1, 1)))

            create(
                Builder('membership').having(
                    member=lucas,
                    committee=self.committee,
                    date_from=localized_datetime(2016, 1, 1),
                    date_to=localized_datetime(2017, 1, 1)))

            create(
                Builder('membership').having(
                    member=kevin,
                    committee=self.committee,
                    date_from=localized_datetime(2016, 1, 1),
                    date_to=localized_datetime(2017, 1, 1)))

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        expected_members = [
            'Andermatt Anton',
            'Kummermuth Kevin',
            'Lenz Lucas',
            u'Sch\xf6ller Heidrun',
            'Wendler Jens',
            u'W\xf6lfl Gerda',
        ]
        self.assertEquals(
            expected_members,
            browser.css('#current_membersBox li:not(.moreLink)').text)
 def test_meeting_data_for_zip_export_json(self):
     self.login(self.committee_responsible)
     self.schedule_paragraph(self.meeting, u'A Gesch\xfcfte')
     with freeze(localized_datetime(2017, 12, 13)):
         self.schedule_ad_hoc(self.meeting, u'Ad-hoc Traktand\xfem')
     self.schedule_proposal(self.meeting, self.submitted_word_proposal)
     self.assertEquals({
         'agenda_items': [{
             'title': u'A Gesch\xfcfte',
         }, {
             'number': '1.',
             'proposal': {
                 'checksum': 'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                 'file': u'1. Ad-hoc Traktandthm/Ad hoc agenda item Ad-hoc Traktandthm.docx',
                 'modified': u'2017-12-12T23:00:00+01:00',
             },
             'title': u'Ad-hoc Traktand\xfem',
         }, {
             'attachments': [{
                 'checksum': '51d6317494eccc4a73154625a6820cb6b50dc1455eb4cf26399299d4f9ce77b2',
                 'file': u'2. Anderungen am Personalreglement/Vertragsentwurf.docx',
                 'modified': u'2016-08-31T15:21:46+02:00',
                 'title': u'Vertr\xe4gsentwurf',
             }],
             'number': '2.',
             'proposal': {
                 'checksum': 'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                 'file': u'2. Anderungen am Personalreglement/Anderungen am Personalreglement.docx',
                 'modified': u'2016-08-31T15:21:44+02:00',
             },
             'title': u'\xc4nderungen am Personalreglement',
         }],
         'committee': {
             'oguid': u'plone:1009233300',
             'title': u'Rechnungspr\xfcfungskommission',
         },
         'end': u'2016-09-12T17:00:00+00:00',
         'location': u'B\xfcren an der Aare',
         'start': u'2016-09-12T15:30:00+00:00',
         'title': u'9. Sitzung der Rechnungspr\xfcfungskommission',
     }, self.meeting.get_data_for_zip_export())
    def test_membership_shows_members_alphabetically(self, browser):
        with freeze(localized_datetime(2016, 1, 10)):
            self.login(self.administrator)
            anton = create(Builder('member')
                           .having(firstname=u'Anton', lastname=u'Andermatt'))
            lucas = create(Builder('member')
                           .having(firstname=u'Lucas', lastname=u'Lenz'))
            kevin = create(Builder('member')
                           .having(firstname=u'Kevin', lastname=u'Kummermuth'))

            create(Builder('membership')
                   .having(member=anton,
                           committee=self.committee,
                           date_from=localized_datetime(2016, 1, 1),
                           date_to=localized_datetime(2017, 1, 1)))

            create(Builder('membership')
                   .having(member=lucas,
                           committee=self.committee,
                           date_from=localized_datetime(2016, 1, 1),
                           date_to=localized_datetime(2017, 1, 1)))

            create(Builder('membership')
                   .having(member=kevin,
                           committee=self.committee,
                           date_from=localized_datetime(2016, 1, 1),
                           date_to=localized_datetime(2017, 1, 1)))

            self.login(self.committee_responsible, browser)
            browser.open(self.committee, view='tabbedview_view-overview')

        expected_members = [
            'Andermatt Anton',
            'Kummermuth Kevin',
            'Lenz Lucas',
            u'Sch\xf6ller Heidrun',
            'Wendler Jens',
            u'W\xf6lfl Gerda',
            ]
        self.assertEquals(
            expected_members,
            browser.css('#current_membersBox li:not(.moreLink)').text)
    def test_exported_meeting_json_has_correct_file_names(self, browser):
        set_preferred_language(self.portal.REQUEST, 'de-ch')
        browser.append_request_header('Accept-Language', 'de-ch')
        self.login(self.committee_responsible, browser)

        self.meeting.model.title = u'9. Sitzung der Rechnungspr\xfcfungs' \
                                   u'kommission, ordentlich'
        self.schedule_paragraph(self.meeting, u'A Gesch\xfcfte')
        with freeze(localized_datetime(2017, 12, 13)):
            self.schedule_ad_hoc(
                self.meeting, u'Ad-hoc Traktand\xfem'
            ).decide()
        agenda_item = self.schedule_proposal(self.meeting, self.submitted_proposal)
        self.decide_agendaitem_generate_and_return_excerpt(agenda_item)
        with freeze(localized_datetime(2017, 12, 14)):
            self.meeting.model.close()

        browser.open(self.meeting, view='export-meeting-zip')
        self.assertEquals('application/zip', browser.contenttype)

        zip_file = ZipFile(StringIO(browser.contents), 'r')

        meeting_json = json.loads(zip_file.read('meeting.json'))

        # the protocol is generated during the tests and its checksum cannot
        # be predicted
        meeting_json['meetings'][0]['protocol']['checksum'] = 'unpredictable'
        meeting_json['meetings'][0].pop('opengever_id')
        for agenda_item in meeting_json['meetings'][0]['agenda_items']:
            agenda_item.pop('opengever_id')

        expected_meeting_json = {
            u'meetings': [{
                u'agenda_items': [
                    {u'sort_order': 1, u'title': u'A Gesch\xfcfte'},
                    {
                        u'number': u'1.',
                        u'number_raw': 1,
                        u'proposal': {
                            u'checksum': u'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                            u'file': u'Traktandum 1/Ad-hoc Traktandthm.docx',
                            u'modified': u'2017-12-13T00:00:00+01:00',
                        },
                        u'sort_order': 2,
                        u'title': u'Ad-hoc Traktand\xfem',
                    },
                    {
                        u'attachments': [{
                            u'checksum': u'51d6317494eccc4a73154625a6820cb6b50dc1455eb4cf26399299d4f9ce77b2',
                            u'file': u'Traktandum 2/Beilage/1_Vertraegsentwurf.docx',
                            u'modified': u'2016-08-31T16:09:37+02:00',
                            u'title': u'Vertr\xe4gsentwurf',
                        }],
                        u'number': u'2.',
                        u'number_raw': 2,
                        u'proposal': {
                            u'checksum': u'114e7a059dc34c7459dab90904685584e331089d80bb6310183a0de009b66c3b',
                            u'file': u'Traktandum 2/Vertraege.docx',
                            u'modified': u'2016-08-31T16:09:35+02:00',
                        },
                        u'sort_order': 3,
                        u'title': u'Vertr\xe4ge',
                    },
                ],
                u'committee': {u'oguid': u'plone:1009313300', u'title': u'Rechnungspr\xfcfungskommission'},
                u'end': u'2016-09-12T17:00:00+00:00',
                u'location': u'B\xfcren an der Aare',
                u'protocol': {
                    u'checksum': 'unpredictable',
                    u'file': u'Protokoll-9. Sitzung der Rechnungspruefungskommission- ordentlich.docx',
                    u'modified': u'2017-12-14T00:00:00+01:00',
                },
                u'start': u'2016-09-12T15:30:00+00:00',
                u'title': u'9. Sitzung der Rechnungspr\xfcfungskommission, ordentlich',
            }],
            u'version': u'1.0.0',
        }
        self.assert_json_structure_equal(expected_meeting_json, meeting_json)

        expected_file_names = [
            'Protokoll-9. Sitzung der Rechnungspruefungskommission- ordentlich.docx',
            'Traktandum 1/Ad-hoc Traktandthm.docx',
            'Traktandum 2/Beilage/1_Vertraegsentwurf.docx',
            'Traktandum 2/Vertraege.docx',
            'meeting.json',
            ]
        file_names = sorted(zip_file.namelist())
        self.assertEqual(expected_file_names, file_names)
Exemplo n.º 29
0
 def localized_datetime(self, *args, **kwargs):
     return localized_datetime(*args, **kwargs)
    def test_exported_meeting_json_has_correct_file_names(self, browser):
        self.login(self.committee_responsible, browser)
        self.schedule_paragraph(self.meeting, u'A Gesch\xfcfte')
        with freeze(localized_datetime(2017, 12, 13)):
            self.schedule_ad_hoc(
                self.meeting, u'Ad-hoc Traktand\xfem'
            ).decide()
        self.schedule_proposal(
            self.meeting, self.submitted_word_proposal
        ).decide()
        with freeze(localized_datetime(2017, 12, 14)):
            self.meeting.model.close()

        browser.open(self.meeting, view='export-meeting-zip')
        self.assertEquals('application/zip', browser.contenttype)

        zip_file = ZipFile(StringIO(browser.contents), 'r')

        meeting_json = json.loads(zip_file.read('meeting.json'))

        # the protocol is generated during the tests and its checksum cannot
        # be predicted
        meeting_json['meetings'][0]['protocol']['checksum'] = 'unpredictable'

        self.assert_json_structure_equal({
            'meetings': [
                {'agenda_items': [
                    {'title': u'A Gesch\xfcfte'},
                    {'number': '1.',
                     'proposal': {
                         'checksum': 'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                         'file': '1. Ad-hoc Traktandthm/Ad hoc agenda item Ad-hoc Traktandthm.docx',
                         'modified': '2017-12-12T23:00:00+01:00'
                     },
                     'title': u'Ad-hoc Traktand\xfem'},
                    {'attachments': [{
                        'checksum': '51d6317494eccc4a73154625a6820cb6b50dc1455eb4cf26399299d4f9ce77b2',
                        'file': '2. Anderungen am Personalreglement/Vertragsentwurf.docx',
                        'modified': '2016-08-31T15:21:46+02:00',
                        'title': u'Vertr\xe4gsentwurf'}],
                     'number': '2.',
                     'proposal': {
                         'checksum': 'e00d6c8fb32c30d3ca3a3f8e5d873565482567561023016d9ca18243ff1cfa14',
                         'file': '2. Anderungen am Personalreglement/Anderungen am Personalreglement.docx',
                         'modified': '2016-08-31T15:21:44+02:00'
                     },
                     'title': u'\xc4nderungen am Personalreglement'}
                 ],
                 'committee': {'oguid': 'plone:1009233300',
                               'title': u'Rechnungspr\xfcfungskommission'},
                 'end': '2016-09-12T17:00:00+00:00',
                 'location': u'B\xfcren an der Aare',
                 'protocol': {
                     'checksum': 'unpredictable',
                     'file': 'Protocol-9. Sitzung der Rechnungsprufungskommission.docx',
                     'modified': '2017-12-13T23:00:00+01:00'
                 },
                 'start': '2016-09-12T15:30:00+00:00',
                 'title': u'9. Sitzung der Rechnungspr\xfcfungskommission'}
                ],
            'version': '1.0.0'
            }, meeting_json)

        file_names = zip_file.namelist()
        for file_name in [
                '1. Ad-hoc Traktandthm/Ad hoc agenda item Ad-hoc Traktandthm.docx',
                '2. Anderungen am Personalreglement/Vertragsentwurf.docx',
                '2. Anderungen am Personalreglement/Anderungen am Personalreglement.docx',
                'Protocol-9. Sitzung der Rechnungsprufungskommission.docx']:
            self.assertIn(file_name, file_names)
Exemplo n.º 31
0
 def localized_datetime(self, *args, **kwargs):
     return localized_datetime(*args, **kwargs)