def setUp(self): feature_class_www = FeatureClassFactory(www=True) feature_class_non_www = FeatureClassFactory(www=False) self.feature_www = FeatureFactory(feature_class=feature_class_www) self.feature_non_www = FeatureFactory(feature_class=feature_class_non_www) self.admin = make_user(username="******", is_admin=True) self.user = make_user(username="******", is_admin=False)
def test_save_model(self): file_admin = FileAdmin(File, self.site) request = self.factory.get("/fake-url/") request.user = self.user # test creating new file instance file = FileFactory.build() file_admin.save_model(request, file, None, None) self.assertEqual(file.uploaded_by, self.user) self.assertEqual(file.last_modified_by, self.user) # test updating existing file instance new_user = make_user(username="******") request.user = new_user file_admin.save_model(request, file, None, None) self.assertEqual(file.uploaded_by, self.user) self.assertEqual(file.last_modified_by, new_user) os.remove(file.file.path)
def setUp(self): self.user = make_user() self.site = AdminSite() self.factory = RequestFactory() self.shp_import = ShapefileImportFactory.build()
def setUp(self): user = make_user() self.file = FileFactory(uploaded_by=user, last_modified_by=user)
def setUp(self): self.user = make_user() self.site = AdminSite() self.factory = RequestFactory()
def setUp(self): self.user = make_user() self.view = FeatureWFSView() factory = RequestFactory() self.request = factory.get(self.test_wfs_url) self.view.request = self.request