Beispiel #1
0
    def test_add_meeting_and_dossier(self, browser):
        # create meeting
        browser.login().open(self.committee, view='add-meeting')
        browser.fill({
            'Start': '01.01.2010 10:00',
            'End': '01.01.2010 11:00',
            'Location': 'Somewhere',
        }).submit()

        # create dossier
        self.assertEqual(u'Meeting on Jan 01, 2010',
                         browser.find('Title').value)
        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(1, len(committee_model.meetings))
        meeting = committee_model.meetings[0]

        self.assertEqual(self.localized_datetime(2010, 1, 1, 10), meeting.start)
        self.assertEqual(self.localized_datetime(2010, 1, 1, 11), meeting.end)
        self.assertEqual('Somewhere', meeting.location)
        self.assertEqual([Member.get(self.peter.member_id)],
                         meeting.participants)
        dossier = meeting.dossier_oguid.resolve_object()
        self.assertIsNotNone(dossier)
        self.assertEquals(u'Meeting on Jan 01, 2010', dossier.title)
        self.assertIsNotNone(meeting.modified)
Beispiel #2
0
    def test_add_meeting_and_dossier(self, browser):
        # create meeting
        browser.login().open(self.committee, view='add-meeting')
        browser.fill({
            'Start': datetime(2010, 1, 1, 10),
            'End': datetime(2010, 1, 1, 11),
            'Location': 'Somewhere',
        }).submit()

        # create dossier
        self.assertEqual(u'Meeting on Jan 01, 2010',
                         browser.find('Title').value)
        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(1, len(committee_model.meetings))
        meeting = committee_model.meetings[0]

        self.assertEqual(self.localized_datetime(2010, 1, 1, 10), meeting.start)
        self.assertEqual(self.localized_datetime(2010, 1, 1, 11), meeting.end)
        self.assertEqual('Somewhere', meeting.location)
        self.assertEqual([Member.get(self.peter.member_id)],
                         meeting.participants)
        dossier = meeting.dossier_oguid.resolve_object()
        self.assertIsNotNone(dossier)
        self.assertEquals(u'Meeting on Jan 01, 2010', dossier.title)
        self.assertIsNotNone(meeting.modified)
Beispiel #3
0
    def test_protocol_participants_can_be_edited(self, browser):
        peter = create(Builder('member'))
        hans = create(
            Builder('member').having(firstname=u'Hans', lastname=u'M\xfcller'))
        create(
            Builder('membership').having(member=peter,
                                         committee=self.committee_model))
        create(
            Builder('membership').having(member=hans,
                                         committee=self.committee_model))
        prev_modified = self.meeting.modified

        browser.login()
        browser.open(self.meeting.get_url(view='protocol'))

        browser.fill({
            'Presidency': str(peter.member_id),
            'Secretary': str(hans.member_id),
            'Participants': str(peter.member_id),
            'Other Participants': 'Klara'
        }).submit()

        self.assertEqual(
            {
                u'redirectUrl':
                u'http://nohost/plone/opengever-meeting-committeecontainer/committee-1/meeting-1/view'
            }, browser.json)
        browser.open(self.meeting.get_url(view='view'))
        self.assertEqual(['Changes saved'], info_messages())

        meeting = Meeting.query.get(self.meeting.meeting_id)
        self.assertGreater(meeting.modified, prev_modified)

        # refresh intances
        meeting = Meeting.query.get(self.meeting.meeting_id)
        peter = Member.get(peter.member_id)
        hans = Member.get(hans.member_id)

        self.assertSequenceEqual([peter], meeting.participants)
        self.assertEqual(peter, meeting.presidency)
        self.assertEqual(hans, meeting.secretary)
        self.assertEqual(u'Klara', meeting.other_participants)
Beispiel #4
0
    def test_protocol_participants_can_be_edited(self, browser):
        peter = create(Builder('member'))
        hans = create(Builder('member').having(
            firstname=u'Hans', lastname=u'M\xfcller'))
        create(Builder('membership').having(
            member=peter,
            committee=self.committee_model))
        create(Builder('membership').having(
            member=hans,
            committee=self.committee_model))
        prev_modified = self.meeting.modified

        browser.login()
        browser.open(self.meeting.get_url(view='protocol'))

        browser.fill({'Presidency': str(peter.member_id),
                      'Secretary': str(hans.member_id),
                      'Participants': str(peter.member_id),
                      'Other Participants': 'Klara'}).submit()

        self.assertEqual({
            u'redirectUrl': u'http://nohost/plone/opengever-meeting-committeecontainer/committee-1/meeting-1/view'},
            browser.json)
        browser.open(self.meeting.get_url(view='view'))
        self.assertEqual(['Changes saved'], info_messages())

        meeting = Meeting.query.get(self.meeting.meeting_id)
        self.assertGreater(meeting.modified, prev_modified)

        # refresh intances
        meeting = Meeting.query.get(self.meeting.meeting_id)
        peter = Member.get(peter.member_id)
        hans = Member.get(hans.member_id)

        self.assertSequenceEqual([peter], meeting.participants)
        self.assertEqual(peter, meeting.presidency)
        self.assertEqual(hans, meeting.secretary)
        self.assertEqual(u'Klara', meeting.other_participants)
Beispiel #5
0
    def test_memers_can_be_edited_in_browser(self, browser):
        browser.login()
        browser.open(self.member.get_edit_url(self.container))

        browser.fill({'Firstname': u'Hanspeter',
                      'Lastname': u'Hansj\xf6rg',
                      'E-Mail': u'*****@*****.**'}).submit()

        self.assertEquals([u'Changes saved'], info_messages())

        member = Member.get(self.member.member_id)
        self.assertIsNotNone(member)
        self.assertEqual(u'Hanspeter', member.firstname)
        self.assertEqual(u'Hansj\xf6rg', member.lastname)
        self.assertEqual(u'*****@*****.**', member.email)
    def test_memers_can_be_edited_in_browser(self, browser):
        browser.login()
        browser.open(self.member.get_edit_url(self.container))

        browser.fill({
            'Firstname': u'Hanspeter',
            'Lastname': u'Hansj\xf6rg',
            'E-Mail': u'*****@*****.**'
        }).submit()

        self.assertEquals([u'Changes saved'], info_messages())

        member = Member.get(self.member.member_id)
        self.assertIsNotNone(member)
        self.assertEqual(u'Hanspeter', member.firstname)
        self.assertEqual(u'Hansj\xf6rg', member.lastname)
        self.assertEqual(u'*****@*****.**', member.email)
    def test_membership_can_be_added(self, browser):
        self.assertEqual(0, len(self.committee.get_memberships()))

        browser.login().open(self.committee, view='add-membership')

        browser.fill({'Start date': '01.01.2010',
                      'End date': '31.12.2010',
                      'Member': str(self.member.member_id),
                      'Role': u'H\xe4nswurscht'}).submit()

        self.assertEquals([u'Record created'], info_messages())

        memberships = self.committee.get_memberships()
        self.assertEqual(1, len(memberships))

        membership = memberships[0]
        self.assertEqual(Member.get(self.member.member_id), membership.member)
        self.assertEqual(date(2010, 1, 1), membership.date_from)
        self.assertEqual(date(2010, 12, 31), membership.date_to)
        self.assertEqual(u'H\xe4nswurscht', membership.role)
    def test_membership_can_be_added(self, browser):
        self.assertEqual(0, len(self.committee.get_memberships()))

        browser.login().open(self.committee, view='add-membership')

        browser.fill({'Start date': '01.01.2010',
                      'End date': '31.12.2010',
                      'Member': str(self.member.member_id),
                      'Role': u'H\xe4nswurscht'}).submit()

        self.assertEquals([u'Record created'], info_messages())

        memberships = self.committee.get_memberships()
        self.assertEqual(1, len(memberships))

        membership = memberships[0]
        self.assertEqual(Member.get(self.member.member_id), membership.member)
        self.assertEqual(date(2010, 1, 1), membership.date_from)
        self.assertEqual(date(2010, 12, 31), membership.date_to)
        self.assertEqual(u'H\xe4nswurscht', membership.role)