Skip to content
Snippets Groups Projects

ENH: Allow insertion and deletion of single entities

Merged Florian Spreckelsen requested to merge f-insert into dev
All threads resolved!
Compare and Show latest version
1 file
+ 32
0
Compare changes
  • Side-by-side
  • Inline
+ 32
0
@@ -201,6 +201,38 @@ TEST(test_entity, test_insert_with_parent) {
EXPECT_EQ(inserted_parent.GetName(), parent.GetName());
}
// TODO(fspreck) cognitive complexity > 25 (threshold)
TEST(test_entity, test_insert_with_property) { // NOLINT
auto transaction = caosdb::transaction::Transaction(
std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr));
auto entity = Entity();
entity.SetId("entity_id");
auto prop = Property();
prop.SetName("prop_name");
prop.SetId("prop_id");
prop.SetImportance("prop_importance");
prop.SetValue("prop_value");
prop.SetUnit("prop_unit");
prop.SetDatatype("prop_dtype");
entity.AppendProperty(prop);
transaction.InsertEntity(&entity);
EXPECT_EQ(entity.GetProperties().Size(), 1);
auto inserted_prop = entity.GetProperties().At(0);
EXPECT_EQ(prop.GetName(), inserted_prop.GetName());
EXPECT_EQ(prop.GetId(), inserted_prop.GetId());
EXPECT_EQ(prop.GetImportance(), inserted_prop.GetImportance());
EXPECT_EQ(prop.GetValue(), inserted_prop.GetValue());
EXPECT_EQ(prop.GetUnit(), inserted_prop.GetUnit());
EXPECT_EQ(prop.GetDatatype(), inserted_prop.GetDatatype());
}
// TODO(tf) cognitive complexity > 25 (threshold)
TEST(test_entity, test_from_id_response) { // NOLINT
IdResponse idResponse;
Loading