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!
1 file
+ 25
0
Compare changes
  • Side-by-side
  • Inline
+ 25
0
@@ -98,6 +98,31 @@ TEST(test_entity, test_insert_with_role) { // NOLINT
EXPECT_EQ(entity.GetValue(), "5.5");
}
TEST(test_entity, test_insert_with_parent) {
auto transaction = caosdb::transaction::Transaction(
std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr));
auto entity = Entity();
entity.SetId("entity_id");
auto parent = Parent();
parent.SetId("parent_id");
parent.SetName("parent_name");
EXPECT_EQ(parent.GetId(), "parent_id");
EXPECT_EQ(parent.GetName(), "parent_name");
entity.AppendParent(parent);
transaction.InsertEntity(&entity);
std::cout << entity.ToString() << std::endl;
EXPECT_EQ(entity.GetId(), "entity_id");
EXPECT_EQ(entity.GetParents().Size(), 1);
auto inserted_parent = entity.GetParents().At(0);
EXPECT_EQ(inserted_parent.GetId(), parent.GetId());
EXPECT_EQ(inserted_parent.GetName(), parent.GetName());
}
// TODO(tf) cognitive complexity > 25 (threshold)
TEST(test_entity, test_from_id_response) { // NOLINT
IdResponse idResponse;
Loading