test fixes
This commit is contained in:
@@ -745,7 +745,7 @@ static void get_file_size(i_provider &provider) {
|
|||||||
res = provider.get_file_size(list.front().api_path, size);
|
res = provider.get_file_size(list.front().api_path, size);
|
||||||
EXPECT_EQ(api_error::success, res);
|
EXPECT_EQ(api_error::success, res);
|
||||||
EXPECT_EQ(utils::encryption::encrypting_reader::calculate_encrypted_size(
|
EXPECT_EQ(utils::encryption::encrypting_reader::calculate_encrypted_size(
|
||||||
8U, true),
|
6U, true),
|
||||||
size);
|
size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -875,17 +875,24 @@ static void get_filesystem_item_from_source_path(const app_config &cfg,
|
|||||||
std::uint64_t size{};
|
std::uint64_t size{};
|
||||||
if (provider.get_provider_type() == provider_type::encrypt) {
|
if (provider.get_provider_type() == provider_type::encrypt) {
|
||||||
source_path =
|
source_path =
|
||||||
utils::path::combine(cfg.get_encrypt_config().path, {"/test.txt"});
|
utils::path::combine(cfg.get_encrypt_config().path, {"test.txt"});
|
||||||
size = utils::encryption::encrypting_reader::calculate_encrypted_size(8U,
|
size = utils::encryption::encrypting_reader::calculate_encrypted_size(6U,
|
||||||
true);
|
true);
|
||||||
} else {
|
} else {
|
||||||
size = 128U;
|
size = 128U;
|
||||||
auto &file = test::create_random_file(size);
|
auto &file = test::create_random_file(size);
|
||||||
api_path =
|
api_path =
|
||||||
fmt::format("/{}", utils::path::strip_to_file_name(file.get_path()));
|
fmt::format("/{}", utils::path::strip_to_file_name(file.get_path()));
|
||||||
|
source_path = file.get_path();
|
||||||
|
|
||||||
create_file(provider, api_path);
|
create_file(provider, api_path);
|
||||||
|
|
||||||
source_path = file.get_path();
|
EXPECT_EQ(api_error::success,
|
||||||
|
set_item_meta(api_path, {
|
||||||
|
{META_SIZE, std::to_string(size)},
|
||||||
|
{META_SOURCE, source_path},
|
||||||
|
}));
|
||||||
|
|
||||||
stop_type stop_requested{false};
|
stop_type stop_requested{false};
|
||||||
auto res = provider.upload_file(api_path, source_path, stop_requested);
|
auto res = provider.upload_file(api_path, source_path, stop_requested);
|
||||||
ASSERT_EQ(api_error::success, res);
|
ASSERT_EQ(api_error::success, res);
|
||||||
@@ -903,7 +910,7 @@ static void get_filesystem_item_from_source_path(const app_config &cfg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void get_filesystem_item_from_source_path_fails_if_file_is_not_found(
|
static void get_filesystem_item_from_source_path_fails_if_file_is_not_found(
|
||||||
const app_config &cfg, i_provider &provider) {
|
app_config &cfg, i_provider &provider) {
|
||||||
fmt::println("testing|{}|{}",
|
fmt::println("testing|{}|{}",
|
||||||
app_config::get_provider_name(provider.get_provider_type()),
|
app_config::get_provider_name(provider.get_provider_type()),
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
@@ -954,8 +961,7 @@ static void run_tests(const app_config &cfg, i_provider &provider) {
|
|||||||
get_filesystem_item_fails_if_directory_is_not_found(provider);
|
get_filesystem_item_fails_if_directory_is_not_found(provider);
|
||||||
|
|
||||||
get_filesystem_item_from_source_path(cfg, provider);
|
get_filesystem_item_from_source_path(cfg, provider);
|
||||||
get_filesystem_item_from_source_path_fails_if_file_is_not_found(cfg,
|
get_filesystem_item_from_source_path_fails_if_file_is_not_found(provider);
|
||||||
provider);
|
|
||||||
// TODO need to test read when file size changes for encrypt provider
|
// TODO need to test read when file size changes for encrypt provider
|
||||||
/*
|
/*
|
||||||
get_item_meta(provider);
|
get_item_meta(provider);
|
||||||
|
Reference in New Issue
Block a user