file db unit tests and fixes
This commit is contained in:
parent
c22594c6ab
commit
f6bd64159f
@ -103,7 +103,7 @@ TYPED_TEST(file_db_test, can_get_directory_api_path) {
|
||||
}
|
||||
|
||||
TYPED_TEST(file_db_test,
|
||||
directory_not_found_is_returned_for_non_existing_directory) {
|
||||
directory_not_found_is_returned_for_non_existing_directory_source) {
|
||||
this->file_db->clear();
|
||||
|
||||
std::string api_path;
|
||||
@ -128,7 +128,8 @@ TYPED_TEST(file_db_test, can_get_file_api_path) {
|
||||
EXPECT_STREQ("/file", api_path.c_str());
|
||||
}
|
||||
|
||||
TYPED_TEST(file_db_test, file_not_found_is_returned_for_non_existing_file) {
|
||||
TYPED_TEST(file_db_test,
|
||||
file_not_found_is_returned_for_non_existing_file_source) {
|
||||
this->file_db->clear();
|
||||
|
||||
std::string api_path;
|
||||
@ -137,5 +138,53 @@ TYPED_TEST(file_db_test, file_not_found_is_returned_for_non_existing_file) {
|
||||
EXPECT_TRUE(api_path.empty());
|
||||
}
|
||||
|
||||
TYPED_TEST(file_db_test, can_get_directory_source_path) {
|
||||
this->file_db->clear();
|
||||
|
||||
EXPECT_EQ(api_error::success, this->file_db->add_directory("/", "c:\\test"));
|
||||
|
||||
std::string source_path;
|
||||
EXPECT_EQ(api_error::success,
|
||||
this->file_db->get_directory_source_path("/", source_path));
|
||||
EXPECT_STREQ("c:\\test", source_path.c_str());
|
||||
}
|
||||
|
||||
TYPED_TEST(
|
||||
file_db_test,
|
||||
directory_not_found_is_returned_for_non_existing_directory_api_path) {
|
||||
this->file_db->clear();
|
||||
|
||||
std::string source_path;
|
||||
EXPECT_EQ(api_error::directory_not_found,
|
||||
this->file_db->get_directory_api_path("/", source_path));
|
||||
EXPECT_TRUE(source_path.empty());
|
||||
}
|
||||
|
||||
TYPED_TEST(file_db_test, can_get_file_source_path) {
|
||||
this->file_db->clear();
|
||||
|
||||
EXPECT_EQ(api_error::success, this->file_db->add_or_update_file({
|
||||
"/file",
|
||||
0U,
|
||||
{},
|
||||
"c:\\test\\file.txt",
|
||||
}));
|
||||
|
||||
std::string source_path;
|
||||
EXPECT_EQ(api_error::success,
|
||||
this->file_db->get_file_source_path("/file", source_path));
|
||||
EXPECT_STREQ("c:\\test\\file.txt", source_path.c_str());
|
||||
}
|
||||
|
||||
TYPED_TEST(file_db_test,
|
||||
file_not_found_is_returned_for_non_existing_file_source) {
|
||||
this->file_db->clear();
|
||||
|
||||
std::string source_path;
|
||||
EXPECT_EQ(api_error::item_not_found,
|
||||
this->file_db->get_file_source_path("/file.txt", source_path));
|
||||
EXPECT_TRUE(source_path.empty());
|
||||
}
|
||||
|
||||
// test can update file source, iv, size
|
||||
} // namespace repertory
|
||||
|
Loading…
x
Reference in New Issue
Block a user