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);
|
||||
EXPECT_EQ(api_error::success, res);
|
||||
EXPECT_EQ(utils::encryption::encrypting_reader::calculate_encrypted_size(
|
||||
8U, true),
|
||||
6U, true),
|
||||
size);
|
||||
return;
|
||||
}
|
||||
@@ -875,17 +875,24 @@ static void get_filesystem_item_from_source_path(const app_config &cfg,
|
||||
std::uint64_t size{};
|
||||
if (provider.get_provider_type() == provider_type::encrypt) {
|
||||
source_path =
|
||||
utils::path::combine(cfg.get_encrypt_config().path, {"/test.txt"});
|
||||
size = utils::encryption::encrypting_reader::calculate_encrypted_size(8U,
|
||||
utils::path::combine(cfg.get_encrypt_config().path, {"test.txt"});
|
||||
size = utils::encryption::encrypting_reader::calculate_encrypted_size(6U,
|
||||
true);
|
||||
} else {
|
||||
size = 128U;
|
||||
auto &file = test::create_random_file(size);
|
||||
api_path =
|
||||
fmt::format("/{}", utils::path::strip_to_file_name(file.get_path()));
|
||||
source_path = file.get_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};
|
||||
auto res = provider.upload_file(api_path, source_path, stop_requested);
|
||||
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(
|
||||
const app_config &cfg, i_provider &provider) {
|
||||
app_config &cfg, i_provider &provider) {
|
||||
fmt::println("testing|{}|{}",
|
||||
app_config::get_provider_name(provider.get_provider_type()),
|
||||
__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_from_source_path(cfg, provider);
|
||||
get_filesystem_item_from_source_path_fails_if_file_is_not_found(cfg,
|
||||
provider);
|
||||
get_filesystem_item_from_source_path_fails_if_file_is_not_found(provider);
|
||||
// TODO need to test read when file size changes for encrypt provider
|
||||
/*
|
||||
get_item_meta(provider);
|
||||
|
Reference in New Issue
Block a user