def test_only_expired_dossiers_can_be_added(self, browser):
        self.login(self.records_manager, browser)

        data = {
            'paths:list': obj2paths([self.expired_dossier]),
            '_authenticator': createToken()
        }

        self.assertEqual(date(2000, 12, 31),
                         IDossier(self.expired_dossier).end)

        with freeze(datetime(2001, 1, 1)):
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)

            browser.find('Save').click()

            self.assertEquals(['There were some errors.'], error_messages())
            self.assertEquals([
                'The retention period of the selected dossiers is not expired.'
            ],
                              browser.css('.fieldErrorBox .error').text)

        with freeze(datetime(2021, 1, 1)):
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)

            browser.find('Save').click()

            self.assertEquals([], error_messages())
            self.assertEquals(['Item created'], info_messages())
예제 #2
0
    def test_only_expired_dossiers_can_be_added(self, browser):
        self.login(self.records_manager, browser)

        data = {'paths:list': obj2paths([self.expired_dossier]),
                '_authenticator': createToken()}

        self.assertEqual(date(2000, 12, 31), IDossier(self.expired_dossier).end)

        with freeze(datetime(2001, 1, 1)):
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)

            browser.find('Save').click()

            self.assertEquals(['There were some errors.'], error_messages())
            self.assertEquals(
                ['The retention period of the selected dossiers is not expired.'],
                browser.css('.fieldErrorBox .error').text)

        with freeze(datetime(2021, 1, 1)):
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)

            browser.find('Save').click()

            self.assertEquals([], error_messages())
            self.assertEquals(['Item created'], info_messages())
    def test_select_all_use_preferred_view_content_query(self, browser):
        dossier = create(Builder("dossier"))

        document_a = create(Builder("document").within(dossier))
        create(Builder("document"))

        data = {"view_name": "documents-proxy", "initialize": 0, "selected_count": 0}
        browser.login().open(dossier, data, view="tabbed_view/select_all")

        self.assertEqual(obj2paths([document_a]), [input.get("value") for input in browser.css("input")])
예제 #4
0
    def test_attached_dossier_are_set_to_offered_state(self, browser):
        data = {'paths:list': obj2paths([self.dossier1, self.dossier3]),
                '_authenticator': createToken()}
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(OFFERED_STATE, api.content.get_state(self.dossier1))
        self.assertEquals(OFFERED_STATE, api.content.get_state(self.dossier3))
예제 #5
0
    def test_selected_dossiers_in_the_list_are_preselected(self, browser):
        data = {'paths:list': obj2paths([self.dossier1, self.dossier3]),
                '_authenticator': createToken()}
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)

        browser.find('Save').click()

        self.assertEquals([self.dossier1, self.dossier3],
                          [rel.to_object for rel in browser.context.dossiers])
예제 #6
0
    def test_attached_dossier_are_set_to_offered_state(self, browser):
        data = {
            'paths:list': obj2paths([self.dossier1, self.dossier3]),
            '_authenticator': createToken()
        }
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(OFFERED_STATE, api.content.get_state(self.dossier1))
        self.assertEquals(OFFERED_STATE, api.content.get_state(self.dossier3))
예제 #7
0
    def test_date_of_submission_is_set_today_for_attached_dossiers(self, browser):
        data = {'paths:list': obj2paths([self.dossier1, self.dossier3]),
                '_authenticator': createToken()}
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(date.today(),
                          ILifeCycle(self.dossier1).date_of_submission)
        self.assertEquals(date.today(),
                          ILifeCycle(self.dossier3).date_of_submission)
예제 #8
0
    def test_only_expired_dossiers_can_be_added(self, browser):
        data = {'paths:list': obj2paths([self.dossier2]),
                '_authenticator': createToken()}
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)

        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals(
            ['The retention period of the selected dossiers is not expired.'],
            browser.css('.fieldErrorBox .error').text)
예제 #9
0
    def test_selected_dossiers_in_the_list_are_preselected(self, browser):
        data = {
            'paths:list': obj2paths([self.dossier1, self.dossier3]),
            '_authenticator': createToken()
        }
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)

        browser.find('Save').click()

        self.assertEquals([self.dossier1, self.dossier3],
                          [rel.to_object for rel in browser.context.dossiers])
예제 #10
0
    def test_attached_dossier_are_set_to_offered_state(self, browser):
        self.login(self.records_manager, browser)

        with freeze(datetime(2037, 1, 1)):
            data = {'paths:list': obj2paths([self.expired_dossier, self.inactive_dossier]),
                    '_authenticator': createToken()}
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)
            browser.find('Save').click()

        self.assertEquals(OFFERED_STATE, api.content.get_state(self.expired_dossier))
        self.assertEquals(OFFERED_STATE, api.content.get_state(self.inactive_dossier))
예제 #11
0
    def test_already_offered_dossiers_cant_be_selected(self, browser):
        self.login(self.records_manager, browser)

        data = {'paths:list': obj2paths([self.offered_dossier_to_archive]),
                '_authenticator': createToken()}
        browser.open(self.repository_root,
                     view='++add++opengever.disposition.disposition',
                     data=data)
        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals(['The dossier {} is already offered in a different '
                           'disposition.'.format(self.offered_dossier_to_archive.Title())],
                          browser.css('.fieldErrorBox .error').text)
예제 #12
0
    def test_selected_dossiers_in_active_states_are_skipped(self, browser):
        self.login(self.records_manager, browser)

        data = {'paths:list': obj2paths([self.empty_dossier]),
                '_authenticator': createToken()}

        browser.open(self.repository_root,
                     view='++add++opengever.disposition.disposition',
                     data=data)
        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals(['Required input is missing.'],
                          browser.css('.fieldErrorBox .error').text)
    def test_select_all_use_preferred_view_content_query(self, browser):
        dossier = create(Builder('dossier'))

        document_a = create(Builder('document').within(dossier))
        create(Builder('document'))

        data = {'view_name': 'documents-proxy',
                'initialize': 0,
                'selected_count': 0}
        browser.login().open(dossier, data, view='tabbed_view/select_all')

        self.assertEqual(
            obj2paths([document_a]),
            [input.get('value') for input in browser.css('input')])
예제 #14
0
    def test_date_of_submission_is_set_today_for_attached_dossiers(self, browser):
        self.login(self.records_manager, browser)

        with freeze(datetime(2037, 1, 1)):
            data = {'paths:list': obj2paths([self.expired_dossier, self.inactive_dossier]),
                    '_authenticator': createToken()}
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)
            browser.find('Save').click()

            self.assertEquals(date.today(),
                              ILifeCycle(self.expired_dossier).date_of_submission)
            self.assertEquals(date.today(),
                              ILifeCycle(self.inactive_dossier).date_of_submission)
예제 #15
0
    def test_selected_dossiers_in_active_states_are_skipped(self, browser):
        dossier4 = create(Builder('dossier').within(self.repository))
        data = {
            'paths:list': obj2paths([dossier4]),
            '_authenticator': createToken()
        }

        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals(['Required input is missing.'],
                          browser.css('.fieldErrorBox .error').text)
    def test_select_all_use_preferred_view_content_query(self, browser):
        dossier = create(Builder('dossier'))

        document_a = create(Builder('document').within(dossier))
        create(Builder('document'))


        data = {'view_name':'documents-proxy',
                'initialize': 0,
                'selected_count': 0}
        browser.login().open(dossier, data, view='tabbed_view/select_all')

        self.assertEqual(
            obj2paths([document_a]),
            [input.get('value') for input in browser.css('input')])
예제 #17
0
    def test_date_of_submission_is_set_today_for_attached_dossiers(
            self, browser):
        data = {
            'paths:list': obj2paths([self.dossier1, self.dossier3]),
            '_authenticator': createToken()
        }
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(date.today(),
                          ILifeCycle(self.dossier1).date_of_submission)
        self.assertEquals(date.today(),
                          ILifeCycle(self.dossier3).date_of_submission)
예제 #18
0
    def test_only_expired_dossiers_can_be_added(self, browser):
        data = {
            'paths:list': obj2paths([self.dossier2]),
            '_authenticator': createToken()
        }
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)

        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals(
            ['The retention period of the selected dossiers is not expired.'],
            browser.css('.fieldErrorBox .error').text)
예제 #19
0
    def test_delete_action_works_for_owner(self, browser):
        self.login(self.regular_user, browser)

        browser.open(
            self.private_folder,
            view='folder_delete_confirmation',
            data={'paths:list': obj2paths([self.private_dossier])},
            )

        browser.find('Delete').click()

        statusmessages.assert_message(u'Items successfully deleted.')

        with self.assertRaises(KeyError):
            self.assertIsNone(self.private_dossier)
예제 #20
0
    def test_already_offered_dossiers_cant_be_selected(self, browser):
        data = {'paths:list': obj2paths([self.dossier1]),
                '_authenticator': createToken()}
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals(['The dossier Dossier A is already offered in '
                           'a different disposition.'],
                          browser.css('.fieldErrorBox .error').text)
예제 #21
0
    def test_selected_dossiers_in_the_list_are_preselected(self, browser):
        self.login(self.records_manager, browser)
        self.disposition.dossiers = []

        dossiers_to_add = [self.inactive_dossier, self.expired_dossier]
        data = {'paths:list': obj2paths(dossiers_to_add),
                '_authenticator': createToken()}

        with freeze(datetime(2037, 1, 1)):
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)

            browser.find('Save').click()

        self.assertEquals(dossiers_to_add,
                          [rel.to_object for rel in browser.context.dossiers])
    def test_already_offered_dossiers_cant_be_selected(self, browser):
        self.login(self.records_manager, browser)

        data = {
            'paths:list': obj2paths([self.offered_dossier_to_archive]),
            '_authenticator': createToken()
        }
        browser.open(self.repository_root,
                     view='++add++opengever.disposition.disposition',
                     data=data)
        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals([
            'The dossier {} is already offered in a different '
            'disposition.'.format(self.offered_dossier_to_archive.Title())
        ],
                          browser.css('.fieldErrorBox .error').text)
    def test_attached_dossier_are_set_to_offered_state(self, browser):
        self.login(self.records_manager, browser)

        with freeze(datetime(2037, 1, 1)):
            data = {
                'paths:list':
                obj2paths([self.expired_dossier, self.inactive_dossier]),
                '_authenticator':
                createToken()
            }
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)
            browser.find('Save').click()

        self.assertEquals(OFFERED_STATE,
                          api.content.get_state(self.expired_dossier))
        self.assertEquals(OFFERED_STATE,
                          api.content.get_state(self.inactive_dossier))
    def test_selected_dossiers_in_the_list_are_preselected(self, browser):
        self.login(self.records_manager, browser)
        self.disposition.dossiers = []

        dossiers_to_add = [self.inactive_dossier, self.expired_dossier]
        data = {
            'paths:list': obj2paths(dossiers_to_add),
            '_authenticator': createToken()
        }

        with freeze(datetime(2037, 1, 1)):
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)

            browser.find('Save').click()

        self.assertEquals(dossiers_to_add,
                          [rel.to_object for rel in browser.context.dossiers])
예제 #25
0
    def test_already_offered_dossiers_cant_be_selected(self, browser):
        data = {
            'paths:list': obj2paths([self.dossier1]),
            '_authenticator': createToken()
        }
        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        browser.login().open(self.root,
                             view='++add++opengever.disposition.disposition',
                             data=data)
        browser.find('Save').click()

        self.assertEquals(['There were some errors.'], error_messages())
        self.assertEquals([
            'The dossier Dossier A is already offered in '
            'a different disposition.'
        ],
                          browser.css('.fieldErrorBox .error').text)
    def test_date_of_submission_is_set_today_for_attached_dossiers(
            self, browser):
        self.login(self.records_manager, browser)

        with freeze(datetime(2037, 1, 1)):
            data = {
                'paths:list':
                obj2paths([self.expired_dossier, self.inactive_dossier]),
                '_authenticator':
                createToken()
            }
            browser.open(self.repository_root,
                         view='++add++opengever.disposition.disposition',
                         data=data)
            browser.find('Save').click()

            self.assertEquals(
                date.today(),
                ILifeCycle(self.expired_dossier).date_of_submission)
            self.assertEquals(
                date.today(),
                ILifeCycle(self.inactive_dossier).date_of_submission)