file db unit tests and fixes
This commit is contained in:
parent
bfd698fd56
commit
f23f214cfc
@ -130,7 +130,7 @@ TYPED_TEST(file_db_test, can_get_file_api_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(file_db_test,
|
TYPED_TEST(file_db_test,
|
||||||
file_not_found_is_returned_for_non_existing_file_source_path) {
|
item_not_found_is_returned_for_non_existing_file_source_path) {
|
||||||
this->file_db->clear();
|
this->file_db->clear();
|
||||||
|
|
||||||
std::string api_path;
|
std::string api_path;
|
||||||
@ -178,7 +178,7 @@ TYPED_TEST(file_db_test, can_get_file_source_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(file_db_test,
|
TYPED_TEST(file_db_test,
|
||||||
file_not_found_is_returned_for_non_existing_file_api_path) {
|
item_not_found_is_returned_for_non_existing_file_api_path) {
|
||||||
this->file_db->clear();
|
this->file_db->clear();
|
||||||
|
|
||||||
std::string source_path;
|
std::string source_path;
|
||||||
@ -187,5 +187,30 @@ TYPED_TEST(file_db_test,
|
|||||||
EXPECT_TRUE(source_path.empty());
|
EXPECT_TRUE(source_path.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TYPED_TEST(file_db_test, can_get_file_data) {
|
||||||
|
this->file_db->clear();
|
||||||
|
|
||||||
|
EXPECT_EQ(api_error::success, this->file_db->add_or_update_file({
|
||||||
|
"/file",
|
||||||
|
1U,
|
||||||
|
{{}, {}},
|
||||||
|
"c:\\test\\file.txt",
|
||||||
|
}));
|
||||||
|
|
||||||
|
i_file_db::file_data data{};
|
||||||
|
EXPECT_EQ(api_error::success, this->file_db->get_file_data("/file", data));
|
||||||
|
EXPECT_STREQ("/file", data.api_path);
|
||||||
|
EXPECT_EQ(1U, data.file_size);
|
||||||
|
EXPECT_EQ(2U, data.iv_list.size());
|
||||||
|
EXPECT_STREQ("c:\\test\\file.txt", data.source_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
TYPED_TEST(file_db_test,
|
||||||
|
item_not_found_is_returned_for_non_existing_file_data_api_path) {
|
||||||
|
this->file_db->clear();
|
||||||
|
|
||||||
|
EXPECT_EQ(api_error::item_not_found,
|
||||||
|
this->file_db->get_file_data("/file", data));
|
||||||
|
}
|
||||||
// test can update file source, iv, size
|
// test can update file source, iv, size
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user