def test_oggbundle_transmogrifier(self): # this is a bit hackish, but since builders currently don't work in # layer setup/teardown and isolation of database content is ensured # on a per test level we abuse just one test to setup the pipeline and # test its data. # load pipeline # XXX move this to a layer self.grant("Manager") # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index() transmogrifier = Transmogrifier(api.portal.get()) IAnnotations(transmogrifier)[BUNDLE_PATH_KEY] = resource_filename( 'opengever.bundle.tests', 'assets/invalid_parent_reference.oggbundle') with self.assertRaises(ReferenceNumberNotFound) as cm: transmogrifier(u'opengever.bundle.oggbundle') self.assertEqual( "Couldn't find container with reference number Client1 7.7.7 " "(referenced as parent by item by GUID GUID-dossier-A-7.7.7-1 )", cm.exception.message)
def test_oggbundle_transmogrifier(self): # this is a bit hackish, but since builders currently don't work in # layer setup/teardown and isolation of database content is ensured # on a per test level we abuse just one test to setup the pipeline and # test its data. # load pipeline # XXX move this to a layer self.grant("Manager") # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index() self.import_bundle('delta_base.oggbundle') self.import_bundle('delta.oggbundle') repofolder_from_base = self.portal.restrictedTraverse( 'ordnungssystem-a/ordnungsposition-1/ordnungsposition-1.1') self.assertEquals(['dossier-1'], repofolder_from_base.objectIds()) dossier = repofolder_from_base.restrictedTraverse('dossier-1') self.assertEqual( u'Dossier 1.1-1 (delta import into existing repofolder)', dossier.title)
def test_oggbundle_transmogrifier(self): # this is a bit hackish, but since builders currently don't work in # layer setup/teardown and isolation of database content is ensured # on a per test level we abuse just one test to setup the pipeline and # test its data. # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index() # load pipeline # XXX move this to a layer self.grant("Manager") transmogrifier = Transmogrifier(api.portal.get()) IAnnotations(transmogrifier)[BUNDLE_PATH_KEY] = resource_filename( 'opengever.bundle.tests', 'assets/business_rule_violations.oggbundle') # We need to add documents to dossiers that have already been created # in the 'closed' state, which isn't allowed for anyone except users # inheriting from `UnrestrictedUser` -> we need elevated privileges with freeze(FROZEN_NOW), elevated_privileges(): transmogrifier(u'opengever.bundle.oggbundle') # test content creation # XXX use separate test-cases based on a layer root = self.assert_repo_root_created() self.assert_deeply_nested_repo_folder_created(root) folder = root.restrictedTraverse( 'ordnungsposition-1/ordnungsposition-1.1') self.assert_deeply_nested_subdossier_created(folder) self.assert_resolved_dossier_with_violations_created(folder) self.assert_disallowed_subobject_type_not_created(root)
def test_oggbundle_transmogrifier(self): # this is a bit hackish, but since builders currently don't work in # layer setup/teardown and isolation of database content is ensured # on a per test level we abuse just one test to setup the pipeline and # test its data. self.login(self.manager) # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index() # load pipeline transmogrifier = Transmogrifier(api.portal.get()) annotations = IAnnotations(transmogrifier) annotations[BUNDLE_PATH_KEY] = resource_filename( 'opengever.bundle.tests', 'assets/basic.oggbundle') unc_share_asset_directory = resource_filename( 'opengever.bundle.tests', 'assets/files_outside_bundle') ingestion_settings = { 'unc_mounts': { u'\\\\host\\mount': unc_share_asset_directory.decode('utf-8') }, } # Shove ingestion settings through JSON deserialization to be as # close as possible to the real thing (unicode strings!). ingestion_settings = json.loads(json.dumps(ingestion_settings)) annotations[BUNDLE_INGESTION_SETTINGS_KEY] = ingestion_settings # We need to add documents to dossiers that have already been created # in the 'closed' state, which isn't allowed for anyone except users # inheriting from `UnrestrictedUser` -> we need elevated privileges with freeze(FROZEN_NOW), elevated_privileges(): transmogrifier(u'opengever.bundle.oggbundle') bundle = annotations[BUNDLE_KEY] # test content creation # XXX use separate test-cases based on a layer root = self.assert_repo_root_created() folder_staff = self.assert_repo_folders_created(root) dossier_peter = self.assert_dossiers_created(folder_staff) self.assert_documents_created(dossier_peter) self.assert_report_data_collected(bundle)
def test_oggbundle_transmogrifier(self): # this is a bit hackish, but since builders currently don't work in # layer setup/teardown and isolation of database content is ensured # on a per test level we abuse just one test to setup the pipeline and # test its data. self.login(self.manager) # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index() # load pipeline transmogrifier = Transmogrifier(api.portal.get()) annotations = IAnnotations(transmogrifier) annotations[BUNDLE_PATH_KEY] = resource_filename( 'opengever.bundle.tests', 'assets/basic.oggbundle') unc_share_asset_directory = resource_filename( 'opengever.bundle.tests', 'assets/files_outside_bundle') annotations[BUNDLE_INGESTION_SETTINGS_KEY] = { 'unc_mounts': { u'\\\\host\\mount': unc_share_asset_directory }, } # We need to add documents to dossiers that have already been created # in the 'closed' state, which isn't allowed for anyone except users # inheriting from `UnrestrictedUser` -> we need elevated privileges with freeze(FROZEN_NOW), elevated_privileges(): transmogrifier(u'opengever.bundle.oggbundle') bundle = annotations[BUNDLE_KEY] # test content creation # XXX use separate test-cases based on a layer root = self.assert_repo_root_created() folder_staff = self.assert_repo_folders_created(root) dossier_peter = self.assert_dossiers_created(folder_staff) self.assert_documents_created(dossier_peter) self.assert_report_data_collected(bundle)
def setUp(self): super(TestResolveGUID, self).setUp() # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index()
def test_oggbundle_transmogrifier(self): # this is a bit hackish, but since builders currently don't work in # layer setup/teardown and isolation of database content is ensured # on a per test level we abuse just one test to setup the pipeline and # test its data. self.login(self.manager) # Create the 'bundle_guid' index. In production, this will be done # by the "bin/instance import" command in opengever.bundle.console add_guid_index() # load pipeline transmogrifier = Transmogrifier(api.portal.get()) annotations = IAnnotations(transmogrifier) annotations[BUNDLE_PATH_KEY] = resource_filename( 'opengever.bundle.tests', 'assets/basic.oggbundle') unc_share_asset_directory = resource_filename( 'opengever.bundle.tests', 'assets/files_outside_bundle') ingestion_settings = { 'unc_mounts': { u'\\\\host\\mount': unc_share_asset_directory.decode('utf-8') }, } # Shove ingestion settings through JSON deserialization to be as # close as possible to the real thing (unicode strings!). ingestion_settings = json.loads(json.dumps(ingestion_settings)) annotations[BUNDLE_INGESTION_SETTINGS_KEY] = ingestion_settings # We need to add documents to dossiers that have already been created # in the 'closed' state, which isn't allowed for anyone except users # inheriting from `UnrestrictedUser` -> we need elevated privileges with freeze(FROZEN_NOW), elevated_privileges(): transmogrifier(u'opengever.bundle.oggbundle') bundle = annotations[BUNDLE_KEY] # test content creation # XXX use separate test-cases based on a layer # The structure of the imported bundle is as follows # * reporoot: Ordnungssystem # * branch_repofolder: Organisation # * leaf_repofolder: Personal # * empty_dossier: Dossier Peter Schneider # * dossier: Hanspeter Muller # * document1: Bewerbung Hanspeter Muller # * document2: Entlassung Hanspeter Muller # * mail1: Ein Mail # * mail2: Mail without title # * document3: Document referenced via UNC-Path # * document4: Nonexistent document referenced via UNC-Path with Umlaut # * empty_repofolder: Organigramm, Prozesse # # Some more elements get imported in existing positions from the # the fixture. Where they will be imported can change when elements # are added in the fixture. # * dossier2 (in position 1.1, i.e. self.leaf_repofolder): Dossier in bestehendem Examplecontent Repository # * document5 (in position 1.1 / 1 i.e. self.dossier): Dokument in bestehendem Examplecontent Dossier # * mail3 (in position 1.1 / 1 i.e. self.dossier): : Mail in bestehendem Examplecontent Dossier reporoot = self.assert_reporoot_created() branch_repofolder = self.assert_organization_folder_created(reporoot) self.assert_empty_repofolder_created(branch_repofolder) leaf_repofolder = self.assert_leaf_repofolder_created( branch_repofolder) self.assert_empty_dossier_created(leaf_repofolder) self.assert_dossier2_created() dossier = self.assert_dossier_created(leaf_repofolder) self.assert_document1_created(dossier) self.assert_document2_created(dossier) self.assert_mail1_created(dossier) self.assert_mail2_created(dossier) self.assert_document3_created(dossier) self.assert_document4_created(dossier) self.assert_document5_created() self.assert_mail3_created() self.assert_report_data_collected(bundle)