def test_migrate(self): dir = self.src.directories.create({ 'description': uuid4().hex, 'name': uuid4().hex, 'status': 'DISABLED', 'custom_data': {'hi': 'there'}, }) custom_data = dir.custom_data strength = dir.password_policy.strength strength.max_length = 100 strength.min_length = 1 strength.min_lower_case = 0 strength.min_numeric = 0 strength.min_symbol = 0 strength.min_upper_case = 0 strength.min_diacritic = 0 strength.save() migrator = DirectoryMigrator(destination_client=self.dst, source_directory=dir) copied_dir = migrator.migrate() copied_custom_data = copied_dir.custom_data copied_strength = copied_dir.password_policy.strength self.assertEqual(copied_dir.description, dir.description) self.assertEqual(copied_dir.name, dir.name) self.assertEqual(copied_dir.status, dir.status) self.assertEqual(copied_custom_data['hi'], custom_data['hi']) for key in sanitize(strength).keys(): self.assertEqual(copied_strength[key], strength[key]) dir.delete() copied_dir.delete()
def test_removes_fields(self): obj = sanitize(self.directory.provider) self.assertFalse(obj.get('href')) self.assertFalse(obj.get('created_at')) self.assertFalse(obj.get('modified_at'))