Skip to content
Snippets Groups Projects
Commit dfdce337 authored by florian's avatar florian
Browse files

DRAFT: Add test for inserting with a parent

parent 85703569
No related branches found
No related tags found
1 merge request!4ENH: Allow insertion and deletion of single entities
Pipeline #11187 failed
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment