예제 #1
0
    def test_dispose_is_only_allowed_when_disposition_contains_dossier_to_archive(self):
        self.grant('Archivist')
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.dossier1, archive=False)
        appraisal.update(dossier=self.dossier2, archive=False)
        api.content.transition(self.disposition,
                               'disposition-transition-appraise')

        self.grant('Records Manager')
        with self.assertRaises(InvalidParameterError):
            api.content.transition(self.disposition,
                                   'disposition-transition-dispose')

        appraisal.update(dossier=self.dossier1, archive=True)
        api.content.transition(self.disposition, 'disposition-transition-dispose')
예제 #2
0
    def test_direct_close_is_not_allowed_for_archivists(self):
        self.grant('Archivist')
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.dossier1, archive=False)
        appraisal.update(dossier=self.dossier2, archive=False)
        api.content.transition(self.disposition,
                               'disposition-transition-appraise')

        with self.assertRaises(InvalidParameterError):
            api.content.transition(
                self.disposition, 'disposition-transition-appraised-to-closed')

        self.grant('Records Manager')
        api.content.transition(self.disposition,
                               'disposition-transition-appraised-to-closed')
예제 #3
0
    def test_direct_close_is_not_allowed_for_archivists(self):
        self.grant('Archivist')
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.dossier1, archive=False)
        appraisal.update(dossier=self.dossier2, archive=False)
        api.content.transition(self.disposition,
                               'disposition-transition-appraise')

        with self.assertRaises(InvalidParameterError):
            api.content.transition(self.disposition,
                                   'disposition-transition-appraised-to-closed')

        self.grant('Records Manager')
        api.content.transition(self.disposition,
                               'disposition-transition-appraised-to-closed')
예제 #4
0
    def test_direct_close_is_not_allowed_for_archivists(self):
        self.login(self.archivist)
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.offered_dossier_to_archive,
                         archive=False)
        api.content.transition(obj=self.disposition,
                               transition='disposition-transition-appraise')

        with self.assertRaises(InvalidParameterError):
            api.content.transition(
                obj=self.disposition,
                transition='disposition-transition-appraised-to-closed')

        self.login(self.records_manager)
        api.content.transition(self.disposition,
                               'disposition-transition-appraised-to-closed')
예제 #5
0
    def test_dispose_is_only_allowed_when_disposition_contains_dossier_to_archive(
            self):
        self.login(self.archivist)
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.offered_dossier_to_archive,
                         archive=False)
        api.content.transition(obj=self.disposition,
                               transition='disposition-transition-appraise')

        self.login(self.records_manager)
        with self.assertRaises(InvalidParameterError):
            api.content.transition(self.disposition,
                                   'disposition-transition-dispose')

        appraisal.update(dossier=self.offered_dossier_to_archive, archive=True)
        api.content.transition(self.disposition,
                               'disposition-transition-dispose')
예제 #6
0
    def test_dispose_is_only_allowed_when_disposition_contains_dossier_to_archive(
            self):
        self.grant('Archivist')
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.dossier1, archive=False)
        appraisal.update(dossier=self.dossier2, archive=False)
        api.content.transition(self.disposition,
                               'disposition-transition-appraise')

        self.grant('Records Manager')
        with self.assertRaises(InvalidParameterError):
            api.content.transition(self.disposition,
                                   'disposition-transition-dispose')

        appraisal.update(dossier=self.dossier1, archive=True)
        api.content.transition(self.disposition,
                               'disposition-transition-dispose')
예제 #7
0
    def test_appraisal_is_in_complete_when_not_all_dossiers_are_appraised(self):
        dossier3 = create(Builder('dossier')
                          .having(archival_value=ARCHIVAL_VALUE_SAMPLING)
                          .as_expired()
                          .within(self.repository))

        disposition = create(Builder('disposition')
                             .having(dossiers=[self.dossier1,
                                               self.dossier2,
                                               dossier3])
                             .within(self.root))

        appraisal = IAppraisal(disposition)
        self.assertFalse(appraisal.is_complete())

        appraisal.update(dossier=dossier3, archive=True)
        self.assertTrue(appraisal.is_complete())
예제 #8
0
    def test_appraisal_is_in_complete_when_not_all_dossiers_are_appraised(
            self):
        dossier3 = create(
            Builder('dossier').having(
                archival_value=ARCHIVAL_VALUE_SAMPLING).as_expired().within(
                    self.repository))

        disposition = create(
            Builder('disposition').having(
                dossiers=[self.dossier1, self.dossier2, dossier3]).within(
                    self.root))

        appraisal = IAppraisal(disposition)
        self.assertFalse(appraisal.is_complete())

        appraisal.update(dossier=dossier3, archive=True)
        self.assertTrue(appraisal.is_complete())
예제 #9
0
    def test_appraisal_is_incomplete_when_not_all_dossiers_are_appraised(self):
        self.login(self.records_manager)
        self.set_workflow_state("dossier-state-resolved", self.dossier, self.empty_dossier)
        ILifeCycle(self.expired_dossier).archival_value = ARCHIVAL_VALUE_WORTHY
        ILifeCycle(self.empty_dossier).archival_value = ARCHIVAL_VALUE_UNWORTHY
        ILifeCycle(self.dossier).archival_value = ARCHIVAL_VALUE_SAMPLING

        disposition = create(Builder('disposition')
                             .having(dossiers=[self.expired_dossier,
                                               self.empty_dossier,
                                               self.dossier])
                             .within(self.repository_root))

        appraisal = IAppraisal(disposition)
        self.assertFalse(appraisal.is_complete())

        appraisal.update(dossier=self.dossier, archive=True)
        self.assertTrue(appraisal.is_complete())
예제 #10
0
    def test_appraising_is_not_possible_if_the_appraisal_is_incomplete(self, browser):
        self.grant('Archivist')
        browser.login().open(self.disposition)
        browser.click_on('disposition-transition-appraise')

        self.assertEquals(
            ['The appraisal is incomplete, appraisal could not be finalized.'],
            error_messages())
        self.assertEquals('disposition-state-in-progress',
                          api.content.get_state(self.disposition))

        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.dossier1, archive=False)
        appraisal.update(dossier=self.dossier2, archive=True)
        transaction.commit()

        browser.login().open(self.disposition)
        browser.click_on('disposition-transition-appraise')
        self.assertEquals('disposition-state-appraised',
                          api.content.get_state(self.disposition))
예제 #11
0
    def test_appraising_is_not_possible_if_the_appraisal_is_incomplete(
            self, browser):
        self.login(self.archivist, browser)
        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.offered_dossier_to_archive, archive=None)

        browser.open(self.disposition)
        browser.click_on('disposition-transition-appraise')

        self.assertEquals(
            ['The appraisal is incomplete, appraisal could not be finalized.'],
            error_messages())
        self.assertEquals('disposition-state-in-progress',
                          api.content.get_state(self.disposition))

        appraisal.update(dossier=self.offered_dossier_to_archive, archive=True)

        browser.open(self.disposition)
        browser.click_on('disposition-transition-appraise')
        self.assertEquals('disposition-state-appraised',
                          api.content.get_state(self.disposition))
예제 #12
0
    def test_appraising_is_not_possible_if_the_appraisal_is_incomplete(
            self, browser):
        self.grant('Archivist')
        browser.login().open(self.disposition)
        browser.click_on('disposition-transition-appraise')

        self.assertEquals(
            ['The appraisal is incomplete, appraisal could not be finalized.'],
            error_messages())
        self.assertEquals('disposition-state-in-progress',
                          api.content.get_state(self.disposition))

        appraisal = IAppraisal(self.disposition)
        appraisal.update(dossier=self.dossier1, archive=False)
        appraisal.update(dossier=self.dossier2, archive=True)
        transaction.commit()

        browser.login().open(self.disposition)
        browser.click_on('disposition-transition-appraise')
        self.assertEquals('disposition-state-appraised',
                          api.content.get_state(self.disposition))
예제 #13
0
    def test_when_appraising_final_archival_value_is_stored_on_dossier(self):
        self.login(self.archivist)

        appraisal = IAppraisal(self.disposition)
        self.assertEquals(
            ARCHIVAL_VALUE_WORTHY,
            ILifeCycle(self.offered_dossier_to_archive).archival_value)
        self.assertEquals(
            ARCHIVAL_VALUE_UNWORTHY,
            ILifeCycle(self.offered_dossier_to_destroy).archival_value)

        appraisal.update(dossier=self.offered_dossier_to_archive,
                         archive=False)
        appraisal.update(dossier=self.offered_dossier_to_destroy, archive=True)
        api.content.transition(self.disposition,
                               transition='disposition-transition-appraise')

        self.assertEquals(
            ARCHIVAL_VALUE_UNWORTHY,
            ILifeCycle(self.offered_dossier_to_archive).archival_value)
        self.assertEquals(
            ARCHIVAL_VALUE_WORTHY,
            ILifeCycle(self.offered_dossier_to_destroy).archival_value)