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

TST: Add another unit test

parent fc4969d3
No related branches found
No related tags found
1 merge request!4ENH: Allow insertion and deletion of single entities
Pipeline #11193 passed
Pipeline: caosdb-cppinttest

#11195

    This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
    ......@@ -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;
    ......
    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