예제 #1
0
    def test_doesnt_raise_if_not_strict_and_user_doesnt_exist(self):
        migrator = CreatorMigrator(
            self.portal, {'old.user': '******'}, 'move', strict=False)

        migrator.migrate()
        self.assertEquals(('doesnt.exist', ), self.dossier.creators)
        self.assertEquals(('doesnt.exist', ), self.doc.creators)
예제 #2
0
 def execute(self, principal_mapping, mode):
     migrator = CreatorMigrator(self.portal,
                                principal_mapping,
                                mode=mode,
                                strict=True)
     results = migrator.migrate()
     return results
예제 #3
0
    def test_returns_proper_results_for_moving_creator(self):
        migrator = CreatorMigrator(
            self.portal, {'old.user': '******'}, 'move')
        results = migrator.migrate()

        self.assertEquals(
            [
                ('/plone/dossier-1', 'old.user', 'new.user'),
                ('/plone/dossier-1/document-1', 'old.user', 'new.user'),
            ],
            results['creators']['moved']
        )
예제 #4
0
    def test_creator_index_gets_updated(self):
        migrator = CreatorMigrator(
            self.portal, {'old.user': '******'}, 'move')
        migrator.migrate()

        # Index should be up to date
        self.assertEquals('new.user',
                          index_data_for(self.dossier).get('Creator'))
        self.assertEquals('new.user',
                          index_data_for(self.doc).get('Creator'))

        # Metadata should be up to date
        self.assertEquals(('new.user', ), obj2brain(self.dossier).listCreators)
        self.assertEquals(('new.user', ), obj2brain(self.doc).listCreators)

        self.assertEquals('new.user', obj2brain(self.dossier).Creator)
        self.assertEquals('new.user', obj2brain(self.doc).Creator)
예제 #5
0
 def execute(self, principal_mapping, mode):
     migrator = CreatorMigrator(self.portal, principal_mapping,
                                mode=mode, strict=True)
     results = migrator.migrate()
     return results
예제 #6
0
    def test_raises_if_strict_and_user_doesnt_exist(self):
        migrator = CreatorMigrator(
            self.portal, {'old.user': '******'}, 'move')

        with self.assertRaises(UserMigrationException):
            migrator.migrate()
예제 #7
0
 def test_uppercase_creator_accessor_works_after_migration(self):
     migrator = CreatorMigrator(
         self.portal, {'old.user': '******'}, 'move')
     migrator.migrate()
     self.assertEquals('new.user', self.dossier.Creator())
     self.assertEquals('new.user', self.doc.Creator())
예제 #8
0
 def test_creators_get_migrated(self):
     migrator = CreatorMigrator(
         self.portal, {'old.user': '******'}, 'move')
     migrator.migrate()
     self.assertEquals(('new.user',), self.dossier.creators)
     self.assertEquals(('new.user',), self.doc.creators)