Skip to content
Snippets Groups Projects
Commit 2f5c2cb8 authored by Alexander Kreft's avatar Alexander Kreft
Browse files

TST: add test for uploading a file

parent 6ac27581
No related branches found
No related tags found
1 merge request!4F full ak
Pipeline #12639 failed
......@@ -194,6 +194,33 @@ end
end
@testset "Test upload File" begin
fname = string(uuid4()) # file name
#create temp file
touch(fname)
write(fname, "Some Content")
path = string(pwd(), "/", fname)
ent_with_name = CaosDB.Entity.create_entity("TestFile")
set_role(ent_with_name, "FILE")
set_local_path(ent_with_name, path)
set_file_path(ent_with_name, string("/Inttests/", fname))
single_insert_transaction = create_transaction()
add_insert_entity(single_insert_transaction, ent_with_name)
execute(single_insert_transaction)
results = get_results(single_insert_transaction)
@test length(results) == 1
@test has_errors(results[1]) == false
@test get_id(results[1]) != ""
#cleanup
rm(fname)
end
@testset "Test retrieve and download File by ID" begin
#a file TestFile is needed on the server!
ent_with_name = execute_query("FIND TestFile")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment