def test_migrate(self): migrator = ApplicationAccountStoreMappingMigrator(destination_application=self.dst_app, source_account_store_mapping=self.src_mapping_1) dst_mapping = migrator.migrate() self.assertEqual(dst_mapping.application.name, self.src_app.name) self.assertEqual(dst_mapping.application.description, self.src_app.description) self.assertEqual(dst_mapping.account_store.name, self.src_dir.name) self.assertEqual(dst_mapping.account_store.description, self.src_dir.description) self.assertEqual(dst_mapping.list_index, self.src_mapping_1.list_index) self.assertEqual(dst_mapping.is_default_account_store, self.src_mapping_1.is_default_account_store) self.assertEqual(dst_mapping.is_default_group_store, self.src_mapping_1.is_default_group_store) migrator = ApplicationAccountStoreMappingMigrator(destination_application=self.dst_app, source_account_store_mapping=self.src_mapping_2) dst_mapping = migrator.migrate() self.assertEqual(dst_mapping.application.name, self.src_app.name) self.assertEqual(dst_mapping.application.description, self.src_app.description) self.assertEqual(dst_mapping.account_store.name, self.src_org.name) self.assertEqual(dst_mapping.account_store.description, self.src_org.description) self.assertEqual(dst_mapping.account_store.name_key, self.src_org.name_key) self.assertEqual(dst_mapping.list_index, self.src_mapping_2.list_index) self.assertEqual(dst_mapping.is_default_account_store, self.src_mapping_2.is_default_account_store) self.assertEqual(dst_mapping.is_default_group_store, self.src_mapping_2.is_default_group_store) migrator = ApplicationAccountStoreMappingMigrator(destination_application=self.dst_app, source_account_store_mapping=self.src_mapping_3) dst_mapping = migrator.migrate() self.assertEqual(dst_mapping.application.name, self.src_app.name) self.assertEqual(dst_mapping.application.description, self.src_app.description) self.assertEqual(dst_mapping.account_store.name, self.src_group.name) self.assertEqual(dst_mapping.account_store.description, self.src_group.description) self.assertEqual(dst_mapping.list_index, self.src_mapping_3.list_index) self.assertEqual(dst_mapping.is_default_account_store, self.src_mapping_3.is_default_account_store)
def test_get_destination_account_store(self): migrator = ApplicationAccountStoreMappingMigrator(destination_application=self.src_app, source_account_store_mapping=self.src_mapping_1) migrator.destination_tenant = migrator.destination_application.tenant migrator.source_account_store = migrator.source_account_store_mapping.account_store account_store = migrator.get_destination_account_store() self.assertEqual(account_store.name, self.dst_dir.name) self.assertEqual(account_store.description, self.dst_dir.description) migrator = ApplicationAccountStoreMappingMigrator(destination_application=self.src_app, source_account_store_mapping=self.src_mapping_2) migrator.destination_tenant = migrator.destination_application.tenant migrator.source_account_store = migrator.source_account_store_mapping.account_store account_store = migrator.get_destination_account_store() self.assertEqual(account_store.name, self.dst_org.name) self.assertEqual(account_store.description, self.dst_org.description) self.assertEqual(account_store.name_key, self.dst_org.name_key) migrator = ApplicationAccountStoreMappingMigrator(destination_application=self.src_app, source_account_store_mapping=self.src_mapping_3) migrator.destination_tenant = migrator.destination_application.tenant migrator.source_account_store = migrator.source_account_store_mapping.account_store account_store = migrator.get_destination_account_store() self.assertEqual(account_store.name, self.dst_group.name) self.assertEqual(account_store.description, self.dst_group.description)