def test_tiff(self): """Uploading a good .tiff """ thefile = os.path.join(TEST_DATA, "test_grid.tif") uploaded = file_upload(thefile) check_layer(uploaded) # Clean up and completely delete the layer uploaded.delete()
def test_shapefile(self): """Test Uploading a good shapefile """ thefile = os.path.join(TEST_DATA, "lembang_schools.shp") uploaded = file_upload(thefile) check_layer(uploaded) # Clean up and completely delete the layer uploaded.delete()
def test_repeated_upload(self): """Upload the same file more than once """ thefile = os.path.join(TEST_DATA, "test_grid.tif") uploaded1 = file_upload(thefile) check_layer(uploaded1) uploaded2 = file_upload(thefile, overwrite=True) check_layer(uploaded2) uploaded3 = file_upload(thefile, overwrite=False) check_layer(uploaded3) msg = "Expected %s but got %s" % (uploaded1.name, uploaded2.name) assert uploaded1.name == uploaded2.name, msg msg = "Expected a different name when uploading %s using " "overwrite=False but got %s" % ( thefile, uploaded3.name, ) assert uploaded1.name != uploaded3.name, msg # Clean up and completely delete the layers # uploaded1 is overwritten by uploaded2 ... no need to delete it uploaded2.delete() uploaded3.delete()