コード例 #1
0
    def test_update_prefix(self):
        dossier = self.stub_dossier()
        sub1 = self.stub_dossier()
        sub2 = self.stub_dossier()
        subsub1 = self.stub_dossier()

        objs = [dossier, sub1, sub2, subsub1]
        self.expect(dossier.get_subdossiers()).result([sub1, sub2])
        self.expect(sub1.get_subdossiers()).result([subsub1])
        self.expect(subsub1.get_subdossiers()).result([])
        self.expect(sub2.get_subdossiers()).result([])

        for obj in objs:
            self.expect(obj.getObject()).result(obj)
            self.expect(obj.reindexObject(idxs=ANY))

        self.replay()

        archiver = IDossierArchiver(dossier)
        archiver.update_prefix('FAKE PREFIX')

        self.assertEquals(dossier.filing_prefix, 'FAKE PREFIX')
        self.assertEquals(sub1.filing_prefix, 'FAKE PREFIX')
        self.assertEquals(sub2.filing_prefix, 'FAKE PREFIX')
        self.assertEquals(subsub1.filing_prefix, 'FAKE PREFIX')
コード例 #2
0
    def test_archiving(self):
        siteroot = self.providing_stub([IAttributeAnnotatable])
        self.mock_utility(siteroot, ISiteRoot)

        dossier = self.stub_dossier()
        sub1 = self.stub_dossier()
        sub2 = self.stub_dossier()
        subsub1 = self.stub_dossier()

        objs = [dossier, sub1, sub2, subsub1]
        self.expect(dossier.get_subdossiers()).result([sub1, sub2])
        self.expect(sub1.get_subdossiers()).result([subsub1])
        self.expect(subsub1.get_subdossiers()).result([])
        self.expect(sub2.get_subdossiers()).result([])

        for obj in objs:
            self.expect(obj.reindexObject(idxs=ANY))
            self.expect(obj.getObject()).result(obj)

        self.replay()

        archiver = IDossierArchiver(dossier)
        archiver.archive('administration', '2013')

        number = 'SKA ARCH-Administration-2013-1'
        self.assertEquals(dossier.filing_no, number)
        self.assertEquals(sub1.filing_no, 'SKA ARCH-Administration-2013-1.1')
        self.assertEquals(sub2.filing_no, 'SKA ARCH-Administration-2013-1.2')
        self.assertEquals(subsub1.filing_no,
                          'SKA ARCH-Administration-2013-1.1.1')
コード例 #3
0
    def test_archiving_with_existing_number(self):
        siteroot = self.providing_stub([IAttributeAnnotatable])
        self.mock_utility(siteroot, ISiteRoot)

        dossier = self.stub_dossier()
        sub1 = self.stub_dossier()
        sub2 = self.stub_dossier()
        subsub1 = self.stub_dossier()

        objs = [dossier, sub1, sub2, subsub1]
        self.expect(dossier.get_subdossiers()).result([sub1, sub2])
        self.expect(sub1.get_subdossiers()).result([subsub1])
        self.expect(subsub1.get_subdossiers()).result([])
        self.expect(sub2.get_subdossiers()).result([])

        for obj in objs:
            self.expect(obj.getObject()).result(obj)
            self.expect(obj.reindexObject(idxs=ANY))

        self.replay()

        archiver = IDossierArchiver(dossier)
        number = 'FAKE NUMBER'
        archiver.archive('administration', '2013', number=number)

        self.assertEquals(dossier.filing_no, 'FAKE NUMBER')
        self.assertEquals(sub1.filing_no, 'FAKE NUMBER.1')
        self.assertEquals(sub2.filing_no, 'FAKE NUMBER.2')
        self.assertEquals(subsub1.filing_no, 'FAKE NUMBER.1.1')
コード例 #4
0
    def test_update_prefix(self):
        dossier = self.stub_dossier()
        sub1 = self.stub_dossier()
        sub2 = self.stub_dossier()
        subsub1 = self.stub_dossier()

        objs = [dossier, sub1, sub2, subsub1]
        self.expect(dossier.get_subdossiers()).result([sub1, sub2])
        self.expect(sub1.get_subdossiers()).result([subsub1])
        self.expect(subsub1.get_subdossiers()).result([])
        self.expect(sub2.get_subdossiers()).result([])

        for obj in objs:
            self.expect(obj.getObject()).result(obj)
            self.expect(obj.reindexObject(idxs=ANY))

        self.replay()

        archiver = IDossierArchiver(dossier)
        archiver.update_prefix('FAKE PREFIX')

        self.assertEquals(dossier.filing_prefix, 'FAKE PREFIX')
        self.assertEquals(sub1.filing_prefix, 'FAKE PREFIX')
        self.assertEquals(sub2.filing_prefix, 'FAKE PREFIX')
        self.assertEquals(subsub1.filing_prefix, 'FAKE PREFIX')