Update PUT test to use fileutils to delte tmp folder
This commit is contained in:
parent
e8afc9f584
commit
b46f366a1d
@ -1,4 +1,5 @@
|
|||||||
require File.expand_path('../../test_helper', __FILE__)
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
class DmsfWebdavIntegrationTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavIntegrationTest < RedmineDmsf::Test::IntegrationTest
|
||||||
|
|
||||||
@ -6,7 +7,7 @@ class DmsfWebdavIntegrationTest < RedmineDmsf::Test::IntegrationTest
|
|||||||
|
|
||||||
def setup
|
def setup
|
||||||
DmsfLock.delete_all #Delete all locks that are in our test DB - probably not safe but ho hum
|
DmsfLock.delete_all #Delete all locks that are in our test DB - probably not safe but ho hum
|
||||||
timestamp = DateTime.now.strftime("%y%m%d%H%M%S")
|
timestamp = DateTime.now.strftime("%y%m%d%H%M")
|
||||||
DmsfFile.storage_path = File.expand_path("./dmsf_test-#{timestamp}", DmsfHelper.temp_dir)
|
DmsfFile.storage_path = File.expand_path("./dmsf_test-#{timestamp}", DmsfHelper.temp_dir)
|
||||||
Dir.mkdir(DmsfFile.storage_path) unless File.directory?(DmsfFile.storage_path)
|
Dir.mkdir(DmsfFile.storage_path) unless File.directory?(DmsfFile.storage_path)
|
||||||
@admin = credentials('admin')
|
@admin = credentials('admin')
|
||||||
@ -18,18 +19,10 @@ class DmsfWebdavIntegrationTest < RedmineDmsf::Test::IntegrationTest
|
|||||||
@headers = nil
|
@headers = nil
|
||||||
#Delete our tmp folder
|
#Delete our tmp folder
|
||||||
begin
|
begin
|
||||||
Dir.entries(DmsfFile.storage_path).each {|x|
|
FileUtils.rm_rf DmsfFile.storage_path
|
||||||
next if (x == "." || x == "..")
|
rescue
|
||||||
begin
|
warn "DELETE FAILED"
|
||||||
File.delete(File.expand_path(x, DmsfFile.storage_path))
|
end
|
||||||
rescue
|
|
||||||
warn "failed to delete #{File.expand_path(x, DmsfFile.storage_path)}"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
Dir.delete(DmsfFile.storage_path)
|
|
||||||
rescue
|
|
||||||
warn "DELETE FAILED"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PUT denied unless authenticated" do
|
test "PUT denied unless authenticated" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user