Ejemplo n.º 1
0
    def test_migrate_properties_without_replace(self):
        portal = self.layer['portal']
        mapping = {'john': 'jack'}
        results = migrate_properties(portal, mapping, replace=False)

        self.assertEquals([], results['moved'])
        self.assertEquals([], results['copied'])
        self.assertEquals([], results['deleted'])

        member = self.mtool.getMemberById('jack')
        self.assertEquals('Jack Bauer', member.getProperty('fullname'))
Ejemplo n.º 2
0
    def test_migrate_properties_with_replace(self):
        portal = self.layer['portal']
        mapping = {'john': 'jack'}
        results = migrate_properties(portal, mapping, replace=True)

        self.assertIn(('mutable_properties', 'john', 'jack'),
                      results['moved'])
        self.assertEquals([], results['copied'])
        self.assertEquals([], results['deleted'])

        member = self.mtool.getMemberById('jack')
        self.assertEquals('John Doe', member.getProperty('fullname'))
Ejemplo n.º 3
0
    def test_delete_properties(self):
        portal = self.layer['portal']
        mapping = {'john': 'peter'}
        results = migrate_properties(portal, mapping, mode='delete')

        self.assertIn(('mutable_properties', 'john', None), results['deleted'])
        self.assertEquals([], results['copied'])
        self.assertEquals([], results['moved'])

        member = self.mtool.getMemberById('peter')
        self.assertEquals('', member.getProperty('fullname'))

        member = self.mtool.getMemberById('john')
        self.assertEquals('', member.getProperty('fullname'))