def setUp(self): init_annalist_test_site() 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", {}) # Create view with duplicate field id self.viewdata = recordview_create_values(view_id="DupField_view") recordview_values_add_field(self.viewdata, field_id="Entity_comment", field_placement="small:0,12") recordview_values_add_field(self.viewdata, field_id="Entity_comment", field_property_uri="rdfs:comment_alt", field_placement="small:0,12") self.testview = RecordView.create(self.testcoll, "DupField_view", self.viewdata) # 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.testcoll1 = Collection(self.testsite, "testcoll1") self.testcoll2 = Collection(self.testsite, "testcoll2") self.fieldcache = CollectionFieldCache() self.field1 = RecordField(self.testcoll1, "field1") self.field1.set_values( recordfield_create_values(field_id="field1", property_uri="test:field1", superproperty_uris=[])) self.field11 = RecordField(self.testcoll1, "field11") self.field11.set_values( recordfield_create_values(field_id="field11", property_uri="test:field11", superproperty_uris=["test:field1"])) self.field111 = RecordField(self.testcoll1, "field111") self.field111.set_values( recordfield_create_values(field_id="field111", property_uri="test:field111", superproperty_uris=["test:field11"])) self.field2 = RecordField(self.testcoll1, "field2") self.field2.set_values( recordfield_create_values(field_id="field2", property_uri="test:field2", superproperty_uris=[])) 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.sitedata = SiteData(self.testsite) self.testcoll = Collection(self.testsite, "testcoll") self.layout = ({ 'enum_field_placement_id': layout.ENUM_FIELD_PLACEMENT_ID, 'enum_list_type_id': layout.ENUM_LIST_TYPE_ID, 'enum_render_type_id': layout.ENUM_RENDER_TYPE_ID, 'enum_value_type_id': layout.ENUM_VALUE_TYPE_ID, 'enum_value_mode_id': layout.ENUM_VALUE_MODE_ID, 'field_typeid': layout.FIELD_TYPEID, 'group_typeid': layout.GROUP_TYPEID, 'list_typeid': layout.LIST_TYPEID, 'type_typeid': layout.TYPE_TYPEID, 'user_typeid': layout.USER_TYPEID, 'view_typeid': layout.VIEW_TYPEID, 'vocab_typeid': layout.VOCAB_TYPEID, 'field_dir': layout.FIELD_DIR, 'group_dir': layout.GROUP_DIR, 'list_dir': layout.LIST_DIR, 'type_dir': layout.TYPE_DIR, 'user_dir': layout.USER_DIR, 'view_dir': layout.VIEW_DIR, 'vocab_dir': layout.VOCAB_DIR }) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.coll1 = collection_values(coll_id="coll1") self.collnewmeta = collection_create_values(coll_id="new") self.collnew = collection_values(coll_id="new") return
def setUp(self): init_annalist_test_site() 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", {}) # Create view with duplicate field id self.viewdata = recordview_create_values(view_id="DupField_view") recordview_values_add_field( self.viewdata, field_id="Entity_comment", field_placement="small:0,12" ) recordview_values_add_field( self.viewdata, field_id="Entity_comment", field_property_uri="rdfs:comment_alt", field_placement="small:0,12" ) self.testview = RecordView.create(self.testcoll, "DupField_view", self.viewdata) # 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() 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("testcoll", "testtype")) self.testtype2 = RecordType.create( self.testcoll, "testtype2", recordtype_create_values("testcoll", "testtype2")) self.testdata = RecordTypeData.create(self.testcoll, "testtype", {}) self.testdata2 = RecordTypeData.create(self.testcoll, "testtype2", {}) e1 = self._create_entity_data("entity1") e2 = self._create_entity_data("entity2") e3 = self._create_entity_data("entity3") e4 = EntityData.create( self.testdata2, "entity4", entitydata_create_values("entity4", type_id="testtype2")) self.type_ids = get_site_types_linked("testcoll") self.type_ids.append( FieldChoice("testtype", label="RecordType testcoll/testtype", link=recordtype_url("testcoll", "testtype"))) self.list_ids = 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") # 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): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.testtype = RecordType(self.testcoll, "testtype") self.testdata = RecordTypeData(self.testcoll, "testtype") return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") # self.tokenset_context = self._make_test_context( # ["aa", "bb", "cc"], repeat_prefix="tokprefix_" # ) self.intvalue_context = self._make_test_context( 42, repeat_prefix="intprefix_") return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) self.user = User.objects.create_user('testuser', '*****@*****.**', 'testpassword') self.user.save() self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("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.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() self.testsite = Site(TestBaseUri, TestBaseDir) self.user = User.objects.create_user( 'testuser', '*****@*****.**', 'testpassword', first_name="Test", last_name="User" ) self.user.save() self.client = Client(HTTP_HOST=TestHost) self.uri = reverse("AnnalistProfileView") self.homeuri = reverse("AnnalistHomeView") return
def setUp(self): # Set up basic site data init_annalist_test_site() 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", {}) # 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.coll1 = Collection.load(self.testsite, "coll1") self.view_url = collection_view_url(coll_id="coll1") self.edit_url = collection_edit_url(coll_id="coll1") self.continuation = "?" + continuation_url_param(self.edit_url) # Login and permissions create_test_user(self.coll1, "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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) # Login and permissions create_test_user( self.testsite.site_data_collection(), # self.testcoll, "testuser", "testpassword", user_permissions=["VIEW", "CREATE", "UPDATE", "DELETE", "CONFIG", "ADMIN"] ) 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() self.imagename = "test-image.jpg" self.imagepath = "%s/%s"%(TestBaseDir, self.imagename) self.imageuri = "file://"+self.imagepath self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) self.img_type = RecordType.create(self.testcoll, "img_type", recordtype_create_values("img_type")) self.img_data = RecordTypeData.create(self.testcoll, "img_type", {}) self.ref_type = RecordType.create(self.testcoll, "ref_type", recordtype_create_values("ref_type")) self.ref_data = RecordTypeData.create(self.testcoll, "ref_type", {}) # 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.testcoll1_a = Collection(self.testsite, "testcoll1") self.testcoll1_b = Collection(self.testsite, "testcoll1") self.testcoll2_a = Collection(self.testsite, "testcoll2") self.testcoll2_b = Collection(self.testsite, "testcoll2") self.typecache = CollectionTypeCache() self.type1 = RecordType(self.testcoll1_a, "type1") self.type1.set_values( recordtype_create_values(type_id="type1", type_uri="test:type1", supertype_uris=[])) self.type11 = RecordType(self.testcoll1_a, "type11") self.type11.set_values( recordtype_create_values(type_id="type11", type_uri="test:type11", supertype_uris=["test:type1"])) self.type111 = RecordType(self.testcoll1_a, "type111") self.type111.set_values( recordtype_create_values(type_id="type111", type_uri="test:type111", supertype_uris=["test:type11"])) self.type12 = RecordType(self.testcoll1_a, "type12") self.type12.set_values( recordtype_create_values(type_id="type12", type_uri="test:type12", supertype_uris=["test:type1"])) self.type2 = RecordType(self.testcoll1_a, "type2") self.type2.set_values( recordtype_create_values(type_id="type2", type_uri="test:type2", supertype_uris=[])) self.type21 = RecordType(self.testcoll1_a, "type21") self.type21.set_values( recordtype_create_values(type_id="type21", type_uri="test:type21", supertype_uris=["test:type2"])) self.type22 = RecordType(self.testcoll1_a, "type22") self.type22.set_values( recordtype_create_values(type_id="type22", type_uri="test:type22", supertype_uris=["test:type2"])) 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create( self.testsite, "testcoll", collection_create_values("testcoll") ) # For checking Location: header values... self.continuation_url = TestHostUri + entitydata_list_type_url( coll_id="testcoll", type_id=layout.USER_TYPEID ) # Login and permissions create_test_user( self.testcoll, "testuser", "testpassword", user_permissions=["VIEW", "CREATE", "UPDATE", "DELETE", "CONFIG", "ADMIN"] ) self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) # self.user = User.objects.create_user('testuser', '*****@*****.**', 'testpassword') # self.user.save() # self.client = Client(HTTP_HOST=TestHost) # Login and permissions create_test_user(None, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) create_user_permissions( self.testsite.site_data_collection(), "testuser", user_permissions= [ "VIEW", "CREATE", "UPDATE", "DELETE", "CONFIG" , "CREATE_COLLECTION", "DELETE_COLLECTION" ] ) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.uri = reverse("AnnalistSiteView") self.homeuri = reverse("AnnalistHomeView") self.profileuri = reverse("AnnalistProfileView") # Login and permissions create_test_user(None, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) create_user_permissions( self.testsite.site_data_collection(), "testuser", user_permissions= [ "VIEW", "CREATE", "UPDATE", "DELETE", "CONFIG" , "CREATE_COLLECTION", "DELETE_COLLECTION" ] ) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.testcoll1_a = Collection(self.testsite, "testcoll1") self.testcoll1_b = Collection(self.testsite, "testcoll1") self.testcoll2_a = Collection(self.testsite, "testcoll2") self.testcoll2_b = Collection(self.testsite, "testcoll2") self.vocabcache = CollectionVocabCache() self.vocab1 = RecordVocab(self.testcoll1_a, "vocab1") self.vocab1.set_values( entitydata_create_values("vocab1", type_id="_vocab", entity_uri="test:vocab1")) self.vocab2 = RecordVocab(self.testcoll1_a, "vocab2") self.vocab2.set_values( entitydata_create_values("vocab2", type_id="_vocab", entity_uri="test:vocab2")) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) 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 = self.no_view_id + get_site_views_linked("testcoll") self.list_options = self.no_list_id + get_site_lists_linked("testcoll") # For checking Location: header values... self.continuation_url = ( TestHostUri + entitydata_list_type_url(coll_id="testcoll", type_id=layout.TYPE_TYPEID) ) # 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) 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 = self.no_view_id + get_site_views_linked("testcoll") self.list_options = self.no_list_id + get_site_lists_linked("testcoll") # For checking Location: header values... self.continuation_url = (TestHostUri + entitydata_list_type_url( coll_id="testcoll", type_id=layout.TYPE_TYPEID)) # 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) self.annalcoll = Collection.load(self.testsite, layout.SITEDATA_ID) self.no_options = [FieldChoice('', label="(no options)")] # For checking Location: header values... self.continuation_url = (TestHostUri + entitydata_list_type_url( coll_id="testcoll", type_id=layout.VOCAB_TYPEID)) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword") create_user_permissions(self.annalcoll, "testuser", user_permissions=["VIEW"]) self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create(self.testsite, "testcoll", collection_create_values("testcoll")) # For checking Location: header values... self.continuation_url = TestHostUri + entitydata_list_type_url( coll_id="testcoll", type_id=layout.USER_TYPEID) # Login and permissions create_test_user(self.testcoll, "testuser", "testpassword", user_permissions=[ "VIEW", "CREATE", "UPDATE", "DELETE", "CONFIG", "ADMIN" ]) 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() 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("testcoll", "testtype")) self.testtype2 = RecordType.create(self.testcoll, "testtype2", recordtype_create_values("testcoll", "testtype2")) self.testdata = RecordTypeData.create(self.testcoll, "testtype", {}) self.testdata2 = RecordTypeData.create(self.testcoll, "testtype2", {}) # self.user = User.objects.create_user('testuser', '*****@*****.**', 'testpassword') # self.user.save() create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) e1 = self._create_entity_data("entity1") e2 = self._create_entity_data("entity2") e3 = self._create_entity_data("entity3") e4 = EntityData.create(self.testdata2, "entity4", entitydata_create_values("entity4", type_id="testtype2") ) self.list_ids = get_site_lists_linked("testcoll") return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.sitedata = SiteData(self.testsite) self.testcoll = Collection(self.testsite, "testcoll") self.layout = ( { 'enum_typeid': layout.ENUM_TYPEID , 'field_typeid': layout.FIELD_TYPEID , 'group_typeid': layout.GROUP_TYPEID , 'list_typeid': layout.LIST_TYPEID , 'type_typeid': layout.TYPE_TYPEID , 'user_typeid': layout.USER_TYPEID , 'view_typeid': layout.VIEW_TYPEID , 'vocab_typeid': layout.VOCAB_TYPEID , 'enum_dir': layout.ENUM_DIR , 'field_dir': layout.FIELD_DIR , 'group_dir': layout.GROUP_DIR , 'list_dir': layout.LIST_DIR , 'type_dir': layout.TYPE_DIR , 'user_dir': layout.USER_DIR , 'view_dir': layout.VIEW_DIR , 'vocab_dir': layout.VOCAB_DIR }) return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.sitedata = SiteData(self.testsite) self.testcoll = Collection(self.testsite, "testcoll") self.layout = ({ 'enum_typeid': layout.ENUM_TYPEID, 'field_typeid': layout.FIELD_TYPEID, 'group_typeid': layout.GROUP_TYPEID, 'list_typeid': layout.LIST_TYPEID, 'type_typeid': layout.TYPE_TYPEID, 'user_typeid': layout.USER_TYPEID, 'view_typeid': layout.VIEW_TYPEID, 'vocab_typeid': layout.VOCAB_TYPEID, 'enum_dir': layout.ENUM_DIR, 'field_dir': layout.FIELD_DIR, 'group_dir': layout.GROUP_DIR, 'list_dir': layout.LIST_DIR, 'type_dir': layout.TYPE_DIR, 'user_dir': layout.USER_DIR, 'view_dir': layout.VIEW_DIR, 'vocab_dir': layout.VOCAB_DIR }) 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.testsite = init_annalist_test_site() self.testcoll = init_annalist_named_test_coll(layout.BIBDATA_ID) self.testdata = RecordTypeData.load(self.testcoll, "testtype") self.testtype2 = RecordType.create( self.testcoll, "testtype2", recordtype_create_values("testcoll", "testtype2") ) self.testdata2 = RecordTypeData.create(self.testcoll, "testtype2", {}) create_test_user(self.testcoll, "testuser", "testpassword") self.client = Client(HTTP_HOST=TestHost) loggedin = self.client.login(username="******", password="******") self.assertTrue(loggedin) e1 = self._create_entity_data("entity1") e2 = self._create_entity_data("entity2") e3 = self._create_entity_data("entity3") e4 = EntityData.create(self.testdata2, "entity4", entitydata_create_values("entity4", type_id="testtype2") ) self.list_ids = get_site_bib_lists_linked("testcoll") return
def setUp(self): self.testsite = init_annalist_test_site() self.testcoll = init_annalist_named_test_coll(layout.BIBDATA_ID) self.no_options = [ FieldChoice('', label="(no options)") ] def special_field(fid): return ( fid.startswith("Field_") or fid.startswith("List_") or fid.startswith("Type_") or fid.startswith("View_") or fid.startswith("User_") ) self.field_options = sorted( [ fid for fid in self.testcoll.child_entity_ids(RecordField, altscope="all") if fid != "_initial_values" ]) self.field_options_no_bibentry = sorted( [ fid for fid in self.testcoll.child_entity_ids(RecordField, altscope="all") if fid != "_initial_values" and not fid.startswith("Bib_") ]) self.field_options_bib_no_special = sorted( [ fid for fid in self.testcoll.child_entity_ids(RecordField, altscope="all") if fid != "_initial_values" and not special_field(fid) ]) self.field_options_no_special = sorted( [ fid for fid in self.testcoll.child_entity_ids(RecordField, altscope="all") if fid != "_initial_values" and not (fid.startswith("Bib_") or special_field(fid)) ]) # log.info(self.field_options_no_bibentry) # For checking Location: header values... self.continuation_path = entitydata_list_type_url( coll_id="testcoll", type_id=layout.VIEW_TYPEID ) self.continuation_url = TestHostUri + self.continuation_path 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_named_test_coll(layout.BIBDATA_ID) # Create BibEntry record (BibEntry_type defines field alias) self.testdata = RecordTypeData.create(self.testcoll, "BibEntry_type", {}) self.bibentity1_data = ( { "@type": [ "bib:BibEntry" , ANNAL.CURIE.EntityData ] , ANNAL.CURIE.type: "bib:BibEntry" , ANNAL.CURIE.type_id: "BibEntry_type" , "bib:type": "article" , "bib:title": "bib:title for bibentity1" , "bib:note": "Sample bibliographic entry with field aliasing" , "bib:month": "09" , "bib:year": "2014" , "bib:author": [ { "bib:id": "author_id" , "bib:name": "Author, J. H." , "bib:alternate": "Joe H. Author" , "bib:firstname": "Joe" , "bib:lastname": "Author" }] , "bib:identifier": [] , "bib:journal": [] , "bib:editor": [] , "bib:publication_details": [] , "bib:license": [] , "bib:bookentry": [] }) self.testbib1 = EntityData.create(self.testdata, "bibentity1", self.bibentity1_data) # 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() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) return
def setUp(self): init_annalist_test_site() return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection(self.testsite, "testcoll") self.testenum = RecordEnumFactory("testenum", "Enum_list_type") return
def setUp(self): init_annalist_test_site() self.testsite = Site(TestBaseUri, TestBaseDir) self.testcoll = Collection.create( self.testsite, "testcoll", collection_create_values("testcoll") ) # Create test types self.testtypes = RecordType.create( self.testcoll, "testtypes", recordtype_create_values( coll_id="testcoll", type_id="testtypes", type_uri="test:testtypes", supertype_uris=[] ) ) self.testtype1 = RecordType.create( self.testcoll, "testtype1", recordtype_create_values( coll_id="testcoll", type_id="testtype1", type_uri="test:testtype1", supertype_uris=["test:testtypes"] ) ) self.testtype2 = RecordType.create( self.testcoll, "testtype2", recordtype_create_values( coll_id="testcoll", type_id="testtype2", type_uri="test:testtype2", supertype_uris=["test:testtypes"] ) ) self.ref_type = RecordType.create( self.testcoll, "ref_type", recordtype_create_values( coll_id="testcoll", type_id="ref_type", type_uri="test:ref_type", supertype_uris=[] ) ) # Create test type data parents self.testdatas = RecordTypeData.create(self.testcoll, "testtypes", {}) self.testdata1 = RecordTypeData.create(self.testcoll, "testtype1", {}) self.testdata2 = RecordTypeData.create(self.testcoll, "testtype2", {}) self.ref_data = RecordTypeData.create(self.testcoll, "ref_type", {}) # Create test type data es = EntityData.create(self.testdatas, "entitys", entitydata_create_values( "entitys", type_id="testtypes", extra_fields={"test:turi": "test:testtypes"} ) ) e1 = EntityData.create(self.testdata1, "entity1", entitydata_create_values( "entity1", type_id="testtype1", extra_fields={"test:turi": "test:testtype1"} ) ) e2 = EntityData.create(self.testdata2, "entity2", entitydata_create_values( "entity2", type_id="testtype2", extra_fields={"test:turi": "test:testtype2"} ) ) # 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