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
Exemple #3
0
 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.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):
     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
Exemple #7
0
 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.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()
     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")
     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):
     # 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):
     # 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
Exemple #14
0
 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()
     self.testsite = Site(TestBaseUri, TestBaseDir)
     self.testcoll = Collection.create(self.testsite, "testcoll",
                                       collection_create_values("testcoll"))
     self.no_options = ['(no options)']
     self.continuation_url = TestHostUri + entitydata_list_type_url(
         coll_id="testcoll", type_id="_list")
     # 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"))
     # 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.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.type_ids = get_site_types_sorted() + ['testtype']
     self.no_options = ['(no options)']
     # 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
Exemple #19
0
 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.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
Exemple #21
0
 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
Exemple #22
0
 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):
     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):
     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
Exemple #25
0
 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
Exemple #26
0
 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.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):
        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 != layout.INITIAL_VALUES_ID
        ])
        self.field_options_no_bibentry = sorted([
            fid for fid in self.testcoll.child_entity_ids(RecordField,
                                                          altscope="all")
            if fid != layout.INITIAL_VALUES_ID 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 != layout.INITIAL_VALUES_ID 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 != layout.INITIAL_VALUES_ID
            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
Exemple #29
0
 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
Exemple #30
0
 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):
     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.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
Exemple #33
0
 def setUp(self):
     self.testsite = init_annalist_test_site()
     self.testcoll = Collection.create(self.testsite, "testcoll",
                                       collection_create_values("testcoll"))
     # Create test type
     self.testtypes = RecordType.create(
         self.testcoll, "testtype",
         recordtype_create_values(coll_id="testcoll",
                                  type_id="testtype",
                                  type_uri="test:testtype",
                                  supertype_uris=[]))
     # Create test type data parents
     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()
     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="_user")
     # 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):
     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):
     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):
     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
Exemple #39
0
 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 = ['(no options)']
     self.view_options = sorted([
         vid for vid in self.testcoll.child_entity_ids(
             RecordView, self.testsite) if vid != "_initial_values"
     ])
     self.list_options = sorted([
         lid for lid in self.testcoll.child_entity_ids(
             RecordList, self.testsite) if lid != "_initial_values"
     ])
     # For checking Location: header values...
     self.continuation_url = TestHostUri + entitydata_list_type_url(
         coll_id="testcoll", type_id="_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.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
Exemple #41
0
 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
    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.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