def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with linked record types, views and lists self.test_supertype_type = RecordType.create( self.testcoll, "test_supertype_type", test_supertype_type_create_values) self.test_subtype_type = RecordType.create( self.testcoll, "test_subtype_type", test_subtype_type_create_values) self.no_options = [FieldChoice('', label="(no options)")] # Create type and data records for testing: self.test_supertype_type_info = EntityTypeInfo(self.testcoll, "test_supertype_type", create_typedata=True) self.test_subtype_type_info = EntityTypeInfo(self.testcoll, "test_subtype_type", create_typedata=True) for entity_id in ("test_subtype_entity", ): self.test_subtype_type_info.create_entity( entity_id, test_subtype_entity_create_values(entity_id)) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): self.filepath = "%s/README.md"%TestBaseDir self.fileuri = "file://"+self.filepath self.imagepath = "%s/test-image.jpg"%TestBaseDir self.imageuri = "file://"+self.filepath init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with record type, view and field self.test_ref_type = RecordType.create( self.testcoll, "testreftype", test_image_ref_type_create_values ) self.test_ref_view = RecordView.create( self.testcoll, "testrefview", test_image_ref_view_create_values ) self.test_ref_field = RecordField.create( self.testcoll, "Test_image_ref", test_image_ref_field_create_values ) # Create data records for testing image references: self.test_ref_type_info = EntityTypeInfo( self.testcoll, "testreftype", create_typedata=True ) self.test_ref_type_info.create_entity("test1", test_ref_entity_create_values(self.imageuri)) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with linked record types, views and lists self.testsrc_type = RecordType.create(self.testcoll, "testsrc_type", testsrc_type_create_values) self.testtgt_type = RecordType.create(self.testcoll, "testtgt_type", testtgt_type_create_values) self.testsrc_view = RecordView.create(self.testcoll, "testsrc_view", testsrc_view_create_values) self.testtgt_view = RecordView.create(self.testcoll, "testtgt_view", testtgt_view_create_values) self.testsrc_list = RecordList.create(self.testcoll, "testsrc_list", testsrc_list_create_values) self.testtgt_list = RecordList.create(self.testcoll, "testtgt_list", testtgt_list_create_values) self.testtgtref_field = RecordField.create(self.testcoll, "testtgtref_field", testtgtref_field_create_values) self.no_options = [ FieldChoice('', label="(no options)") ] self.tgt_options = ( [ FieldChoice("testtgt_type/"+v, label="testtgt_entity %s label"%v, link=entity_url("testcoll", "testtgt_type", v)) for v in ["testtgt1", "testtgt2"] ]) # Create data records for testing: self.testtgt_type_info = EntityTypeInfo(self.testcoll, "testtgt_type", create_typedata=True) self.testsrc_type_info = EntityTypeInfo(self.testcoll, "testsrc_type", create_typedata=True) for tgt_id in ("testtgt1", "testtgt2"): self.testtgt_type_info.create_entity(tgt_id, testtgt_entity_create_values(tgt_id)) for src_id, tgt_ref in (("testsrc1", "testtgt1"), ("testsrc2", "testtgt2")): self.testsrc_type_info.create_entity(src_id, testsrc_entity_create_values(src_id, tgt_ref)) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.testdata = RecordTypeData(self.testcoll, "testtype") # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with linked record types, views and lists self.testsrc_type = RecordType.create(self.testcoll, "testsrc_type", testsrc_type_create_values) self.testtgt_type = RecordType.create(self.testcoll, "testtgt_type", testtgt_type_create_values) self.testsrc_view = RecordView.create(self.testcoll, "testsrc_view", testsrc_view_create_values) self.testtgt_view = RecordView.create(self.testcoll, "testtgt_view", testtgt_view_create_values) self.testsrc_list = RecordList.create(self.testcoll, "testsrc_list", testsrc_list_create_values) self.testtgt_list = RecordList.create(self.testcoll, "testtgt_list", testtgt_list_create_values) self.testtgtref_field = RecordField.create( self.testcoll, "testtgtref_field", testtgtref_field_create_values) self.no_options = [FieldChoice('', label="(no options)")] self.tgt_options = ([ FieldChoice("testtgt_type/" + v, label="testtgt_entity %s label" % v, link=entity_url("testcoll", "testtgt_type", v)) for v in ["testtgt1", "testtgt2"] ]) # Create data records for testing: self.testtgt_type_info = EntityTypeInfo(self.testcoll, "testtgt_type", create_typedata=True) self.testsrc_type_info = EntityTypeInfo(self.testcoll, "testsrc_type", create_typedata=True) for tgt_id in ("testtgt1", "testtgt2"): self.testtgt_type_info.create_entity( tgt_id, testtgt_entity_create_values(tgt_id)) for src_id, tgt_ref in (("testsrc1", "testtgt1"), ("testsrc2", "testtgt2")): self.testsrc_type_info.create_entity( src_id, testsrc_entity_create_values(src_id, tgt_ref)) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): self.fileuri = "file://%s/README.md"%TestBaseDir init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with linked record types, views and lists self.test_imp_type = RecordType.create( self.testcoll, "testimptype", test_import_type_create_values ) self.test_imp_view = RecordView.create( self.testcoll, "testimpview", test_import_view_create_values ) self.test_imp_field = RecordField.create( self.testcoll, "Test_import", test_import_field_create_values ) self.test_ref_type = RecordType.create( self.testcoll, "testreftype", test_reference_type_create_values ) self.test_ref_view = RecordView.create( self.testcoll, "testrefview", test_reference_view_create_values ) self.test_ref_field = RecordField.create( self.testcoll, "Test_reference", test_reference_field_create_values ) # Create data records for testing import and references: self.test_imp_type_info = EntityTypeInfo( self.testcoll, "testimptype", create_typedata=True ) for entity_id in ("test1", "test2"): self.test_imp_type_info.create_entity( entity_id, test_imp_entity_create_values(entity_id) ) self.test_ref_type_info = EntityTypeInfo( self.testcoll, "testreftype", create_typedata=True ) for entity_id in ("test1", "test2"): self.test_ref_type_info.create_entity( entity_id, test_ref_entity_create_values(entity_id) ) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) self.testtype = RecordType.create(self.testcoll, "testtype", recordtype_create_values("testtype")) self.testdata = RecordTypeData.create(self.testcoll, "testtype", {}) self.no_options = [ FieldChoice('', label="(no options)") ] self.no_view_id = [ FieldChoice('', label="(view id)") ] self.no_list_id = [ FieldChoice('', label="(list id)") ] self.view_options = get_site_views_linked("testcoll") self.list_options = get_site_lists_linked("testcoll") # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.coll1 = collection_values("coll1") self.testcoll_add = collection_create_values("testcoll") self.type1_add = recordtype_create_values("testcoll", "type1") self.type1 = recordtype_read_values("testcoll", "type1") self.type2_add = recordtype_create_values("testcoll", "type2") self.type2 = recordtype_read_values("testcoll", "type2") self.view1_add = recordview_create_values("testcoll", "view1") self.view1 = recordview_read_values("testcoll", "view1") self.view2_add = recordview_create_values("testcoll", "view2") self.view2 = recordview_read_values("testcoll", "view2") self.list1_add = recordlist_create_values("testcoll", "list1") self.list1 = recordlist_read_values("testcoll", "list1") self.list2_add = recordlist_create_values("testcoll", "list2") self.list2 = recordlist_read_values("testcoll", "list2") return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) self.testtype = RecordType.create(self.testcoll, "testtype", recordtype_create_values("testtype")) self.testdata = RecordTypeData.create(self.testcoll, "testtype", {}) self.no_options = [FieldChoice('', label="(no options)")] self.no_view_id = [FieldChoice('', label="(view id)")] self.no_list_id = [FieldChoice('', label="(list id)")] self.view_options = get_site_views_linked("testcoll") self.list_options = get_site_lists_linked("testcoll") # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): self.testsite = init_annalist_test_site() self.testcoll = init_annalist_test_coll() self.testsubcoll = create_test_coll_inheriting( base_coll_id="testcoll", coll_id="testsubcoll", type_id="testtype" ) create_test_user(self.testcoll, "testuser", "testpassword") create_test_user(self.testsubcoll, "testsubuser", "testpassword") # Allow user "testuser" access in collectrion "testsubcoll" user_permissions = ["VIEW", "CREATE", "UPDATE", "DELETE", "CONFIG"] user_id = "testuser" user_perms = self.testsubcoll.create_user_permissions( user_id, "mailto:%s@%s"%(user_id, TestHost), "Test Subuser", "User %s: permissions for %s in collection %s"% ( user_id, "Test Subuser", self.testsubcoll.get_id() ), user_permissions) # Block user "testsubuser" access in collection "testcoll" user_permissions = [] user_id = "testsubuser" user_perms = self.testcoll.create_user_permissions( user_id, "mailto:%s@%s"%(user_id, TestHost), "Test Subuser", "User %s: permissions for %s in collection %s"% ( user_id, "Test Subuser", self.testcoll.get_id() ), user_permissions) # Block default user access in collection "testcoll" user_permissions = [] user_id = "_default_user_perms" user_uri = "annal:User/_default_user_perms" user_perms = self.testcoll.create_user_permissions( user_id, user_uri, "Test Subuser", "User %s: permissions for %s in collection %s"% ( user_id, "Test Subuser", self.testcoll.get_id() ), user_permissions) # Create inherited entity "testcoll/testtype/entity2" self.testdata = RecordTypeData.load(self.testcoll, "testtype") self.testentity2 = self._create_entity_data("entity2") self.testsubdata = RecordTypeData.load(self.testsubcoll, "testtype") # loggedin = self.client.login(username="******", password="******") # self.assertTrue(loggedin) self.continuation_url = entitydata_list_type_url( coll_id="testsubcoll", type_id="testtype" ) return
def setUp(self): self.filepath = "%s/testdatafile.md" % TestBaseDir self.fileuri = "file://" + self.filepath self.imagepath = "%s/test-image.jpg" % TestBaseDir self.imageuri = "file://" + self.imagepath init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with linked record types, views and lists # Types self.test_upl_type = RecordType.create(self.testcoll, "testupltype", test_upload_type_create_values) self.test_ref_type = RecordType.create( self.testcoll, "testreftype", test_reference_type_create_values) self.test_image_type = RecordType.create( self.testcoll, "testimgtype", test_image_type_create_values) # Views self.test_upl_file_view = RecordView.create( self.testcoll, "testuplfileview", test_upload_file_view_create_values) self.test_upl_image_view = RecordView.create( self.testcoll, "testuplimageview", test_upload_image_view_create_values) self.test_ref_file_view = RecordView.create( self.testcoll, "testrefview", test_reference_view_create_values) self.test_ref_image_view = RecordView.create( self.testcoll, "testimgrefview", test_image_ref_view_create_values) self.test_image_view = RecordView.create( self.testcoll, "testimgview", test_image_view_create_values) # Fields self.test_upl_file_field = RecordField.create( self.testcoll, "Test_upload_file", test_upload_file_field_create_values) self.test_upl_image_field = RecordField.create( self.testcoll, "Test_upload_image", test_upload_image_field_create_values) self.test_ref_file_field = RecordField.create( self.testcoll, "Test_reference", test_reference_field_create_values) self.test_ref_image_field = RecordField.create( self.testcoll, "Test_image_ref", test_image_ref_field_create_values) self.test_image_field = RecordField.create( self.testcoll, "Test_image", test_image_field_create_values) # Create data records for testing import and references: test_entity_ids = ("test1", "test2") test_entity_ids = ("test1", ) self.test_upl_type_info = EntityTypeInfo(self.testcoll, "testupltype", create_typedata=True) for entity_id in test_entity_ids: self.test_upl_type_info.create_entity( entity_id, test_imp_entity_create_values(entity_id)) self.test_ref_type_info = EntityTypeInfo(self.testcoll, "testreftype", create_typedata=True) for entity_id in test_entity_ids: self.test_ref_type_info.create_entity( entity_id, test_ref_entity_create_values(entity_id)) self.test_img_type_info = EntityTypeInfo(self.testcoll, "testimgtype", create_typedata=True) for entity_id in test_entity_ids: self.test_img_type_info.create_entity( entity_id, test_img_entity_create_values(entity_id)) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): self.filepath = "%s/testdatafile.md"%TestBaseDir self.fileuri = "file://"+self.filepath self.imagepath = "%s/test-image.jpg"%TestBaseDir self.imageuri = "file://"+self.imagepath init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # Populate collection with linked record types, views and lists # Types self.test_upl_type = RecordType.create( self.testcoll, "testupltype", test_upload_type_create_values ) self.test_ref_type = RecordType.create( self.testcoll, "testreftype", test_reference_type_create_values ) self.test_image_type = RecordType.create( self.testcoll, "testimgtype", test_image_type_create_values ) # Views self.test_upl_file_view = RecordView.create( self.testcoll, "testuplfileview", test_upload_file_view_create_values ) self.test_upl_image_view = RecordView.create( self.testcoll, "testuplimageview", test_upload_image_view_create_values ) self.test_ref_file_view = RecordView.create( self.testcoll, "testrefview", test_reference_view_create_values ) self.test_ref_image_view = RecordView.create( self.testcoll, "testimgrefview", test_image_ref_view_create_values ) self.test_image_view = RecordView.create( self.testcoll, "testimgview", test_image_view_create_values ) # Fields self.test_upl_file_field = RecordField.create( self.testcoll, "Test_upload_file", test_upload_file_field_create_values ) self.test_upl_image_field = RecordField.create( self.testcoll, "Test_upload_image", test_upload_image_field_create_values ) self.test_ref_file_field = RecordField.create( self.testcoll, "Test_reference", test_reference_field_create_values ) self.test_ref_image_field = RecordField.create( self.testcoll, "Test_image_ref", test_image_ref_field_create_values ) self.test_image_field = RecordField.create( self.testcoll, "Test_image", test_image_field_create_values ) # Create data records for testing import and references: test_entity_ids = ("test1", "test2") test_entity_ids = ("test1",) self.test_upl_type_info = EntityTypeInfo( self.testcoll, "testupltype", create_typedata=True ) for entity_id in test_entity_ids: self.test_upl_type_info.create_entity( entity_id, test_imp_entity_create_values(entity_id) ) self.test_ref_type_info = EntityTypeInfo( self.testcoll, "testreftype", create_typedata=True ) for entity_id in test_entity_ids: self.test_ref_type_info.create_entity( entity_id, test_ref_entity_create_values(entity_id) ) self.test_img_type_info = EntityTypeInfo( self.testcoll, "testimgtype", create_typedata=True ) for entity_id in test_entity_ids: self.test_img_type_info.create_entity( entity_id, test_img_entity_create_values(entity_id) ) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() init_annalist_test_coll() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") return