Skip to content
Snippets Groups Projects
Verified Commit 04d44a2d authored by Timm Fitschen's avatar Timm Fitschen
Browse files

EHN: also add warnings and info messages from IdResponse to entity

parent 7dbabac6
No related branches found
No related tags found
1 merge request!4ENH: Allow insertion and deletion of single entities
Pipeline #11062 failed
...@@ -80,6 +80,9 @@ Entity::Entity() : wrapped(Entity::CreateProtoEntity()) { ...@@ -80,6 +80,9 @@ Entity::Entity() : wrapped(Entity::CreateProtoEntity()) {
Entity::Entity(IdResponse *idResponse) : Entity() { Entity::Entity(IdResponse *idResponse) : Entity() {
this->wrapped->set_id(idResponse->id()); this->wrapped->set_id(idResponse->id());
this->wrapped->mutable_errors()->Swap(idResponse->mutable_entity_errors()); this->wrapped->mutable_errors()->Swap(idResponse->mutable_entity_errors());
this->wrapped->mutable_warnings()->Swap(
idResponse->mutable_entity_warnings());
this->wrapped->mutable_infos()->Swap(idResponse->mutable_entity_infos());
} }
auto Entity::SetId(const std::string &id) -> void { this->wrapped->set_id(id); } auto Entity::SetId(const std::string &id) -> void { this->wrapped->set_id(id); }
......
...@@ -101,14 +101,14 @@ TEST(test_entity, test_from_id_response) { // NOLINT ...@@ -101,14 +101,14 @@ TEST(test_entity, test_from_id_response) { // NOLINT
Entity other_ent(&idr_warnings_and_infos); Entity other_ent(&idr_warnings_and_infos);
EXPECT_EQ(entity.GetId(), "other_entity_id"); EXPECT_EQ(other_ent.GetId(), "other_entity_id");
EXPECT_EQ(entity.GetWarnings().Size(), 1); EXPECT_EQ(other_ent.GetWarnings().Size(), 1);
EXPECT_EQ(entity.GetWarnings().At(0).GetDescription(), "warning_desc"); EXPECT_EQ(other_ent.GetWarnings().At(0).GetDescription(), "warning_desc");
EXPECT_EQ(entity.GetWarnings().At(0).GetCode(), EXPECT_EQ(other_ent.GetWarnings().At(0).GetCode(),
MessageCode::ENTITY_HAS_NO_PROPERTIES); MessageCode::ENTITY_HAS_NO_PROPERTIES);
EXPECT_EQ(entity.GetInfos().Size(), 1); EXPECT_EQ(other_ent.GetInfos().Size(), 1);
EXPECT_EQ(entity.GetInfos().At(0).GetDescription(), "info_desc"); EXPECT_EQ(other_ent.GetInfos().At(0).GetDescription(), "info_desc");
EXPECT_EQ(entity.GetInfos().At(0).GetCode(), MessageCode::UNSPECIFIED); EXPECT_EQ(other_ent.GetInfos().At(0).GetCode(), MessageCode::UNSPECIFIED);
} }
} // namespace caosdb::entity } // namespace caosdb::entity
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment