@@ -6,6 +6,7 @@ namespace cortex::db {
66namespace {
77constexpr const auto kTestDb = " ./test.db" ;
88}
9+
910class ModelsTestSuite : public ::testing::Test {
1011 public:
1112 ModelsTestSuite ()
@@ -21,9 +22,9 @@ class ModelsTestSuite : public ::testing::Test {
2122 SQLite::Database db_;
2223 cortex::db::Models model_list_;
2324
24- const cortex::db::ModelEntry kTestModel {" test_model_id " , " test_author " ,
25- " main " , " /path/to/model.yaml " ,
26- " test_alias" };
25+ const cortex::db::ModelEntry kTestModel {
26+ " test_model_id " , " test_format " , " test_source " , " active " , " test_engine " ,
27+ " test_author " , " main " , " /path/to/model.yaml " , " test_alias" };
2728};
2829
2930TEST_F (ModelsTestSuite, TestAddModelEntry) {
@@ -33,8 +34,12 @@ TEST_F(ModelsTestSuite, TestAddModelEntry) {
3334 EXPECT_TRUE (retrieved_model);
3435 EXPECT_EQ (retrieved_model.value ().model , kTestModel .model );
3536 EXPECT_EQ (retrieved_model.value ().author_repo_id , kTestModel .author_repo_id );
37+ EXPECT_EQ (retrieved_model.value ().model_format , kTestModel .model_format );
38+ EXPECT_EQ (retrieved_model.value ().model_source , kTestModel .model_source );
39+ EXPECT_EQ (retrieved_model.value ().status , kTestModel .status );
40+ EXPECT_EQ (retrieved_model.value ().engine , kTestModel .engine );
3641
37- // // Clean up
42+ // Clean up
3843 EXPECT_TRUE (model_list_.DeleteModelEntry (kTestModel .model ).value ());
3944}
4045
@@ -59,14 +64,14 @@ TEST_F(ModelsTestSuite, TestUpdateModelEntry) {
5964 EXPECT_TRUE (model_list_.AddModelEntry (kTestModel ).value ());
6065
6166 cortex::db::ModelEntry updated_model = kTestModel ;
67+ updated_model.status = " inactive" ;
6268
6369 EXPECT_TRUE (
6470 model_list_.UpdateModelEntry (kTestModel .model , updated_model).value ());
6571
6672 auto retrieved_model = model_list_.GetModelInfo (kTestModel .model );
6773 EXPECT_TRUE (retrieved_model);
68- EXPECT_TRUE (
69- model_list_.UpdateModelEntry (kTestModel .model , updated_model).value ());
74+ EXPECT_EQ (retrieved_model.value ().status , " inactive" );
7075
7176 // Clean up
7277 EXPECT_TRUE (model_list_.DeleteModelEntry (kTestModel .model ).value ());
@@ -162,4 +167,5 @@ TEST_F(ModelsTestSuite, TestHasModel) {
162167 // Clean up
163168 EXPECT_TRUE (model_list_.DeleteModelEntry (kTestModel .model ).value ());
164169}
165- } // namespace cortex::db
170+
171+ } // namespace cortex::db
0 commit comments