From 2f5c2cb8aab6a01de3cd803cf41c9f06904fdac2 Mon Sep 17 00:00:00 2001 From: Alexander Kreft <akreft@trineo.org> Date: Thu, 26 Aug 2021 10:52:29 +0000 Subject: [PATCH] TST: add test for uploading a file --- test/runtests.jl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index a34010b..d44271a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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") -- GitLab