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

DRAFT: Add NOLINTs and output

parent 6a82bb22
No related branches found
No related tags found
1 merge request!3TST: Add Tests for insert and delete
Pipeline #11206 failed
......@@ -73,7 +73,8 @@ TEST(test_connection, connection_insecure_authentication_error_anonymous) {
EXPECT_THROW(connection.RetrieveVersionInfo(), AuthenticationError);
}
TEST(test_connection, connection_ssl_authentication_error_anonymous) {
// TODO(tf) cognitive complexity > 25 (threshold)
TEST(test_connection, connection_ssl_authentication_error_anonymous) { // NOLINT
const auto *port_str =
caosdb::utility::get_env_var("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
auto port = std::stoi(port_str);
......@@ -92,7 +93,9 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) {
"succeed. Original error: Please login.");
}
TEST(test_connection, connection_ssl_authentication_error_wrong_credentials) {
// TODO(tf) cognitive complexity > 25 (threshold)
TEST(test_connection, // NOLINT
connection_ssl_authentication_error_wrong_credentials) { // NOLINT
const auto *port_str =
caosdb::utility::get_env_var("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
auto port = std::stoi(port_str);
......
......@@ -27,6 +27,7 @@
#include "gtest/gtest-message.h" // for Message
#include "gtest/gtest-test-part.h" // for TestPartResult, SuiteApiResolver
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, AssertionResult
#include <iostream> // for endl, basic_ostream, cout
#include <memory> // for unique_ptr, allocator, __shar...
#include <string> // for string
......@@ -94,7 +95,8 @@ TEST(test_transaction, retrieve_non_existing) {
MessageCode::ENTITY_DOES_NOT_EXIST);
}
TEST(test_transaction, insert_delete) {
// TODO(fspreck) cognitive complexity > 25 (threshold)
TEST(test_transaction, insert_delete) { // NOLINT
const auto &connection =
caosdb::connection::ConnectionManager::GetDefaultConnection();
......@@ -142,8 +144,8 @@ TEST(test_transaction, insert_delete) {
}
// TODO(fspreck) Simplify inserts and deletes once we have
// multi-entity operations
TEST(test_transaction, insert_delete_with_parent) {
// multi-entity operations, also cognitive complexity > threshold
TEST(test_transaction, insert_delete_with_parent) { // NOLINT
const auto &connection =
caosdb::connection::ConnectionManager::GetDefaultConnection();
......@@ -170,7 +172,8 @@ TEST(test_transaction, insert_delete_with_parent) {
rec.SetName("TestRec");
Parent parent;
parent.SetName(rt.GetName());
parent.SetName(inserted_rt.GetName());
parent.SetId(inserted_rt.GetId());
rec.AppendParent(parent);
auto rec_transaction(connection->CreateTransaction());
......@@ -180,13 +183,16 @@ TEST(test_transaction, insert_delete_with_parent) {
auto rec_insert_status = rec_transaction->WaitForIt();
ASSERT_TRUE(rec_insert_status.IsTerminated());
std::cout << rec.ToString() << std::endl;
std::cout << rec_insert_status.GetCode() << std::endl;
ASSERT_FALSE(rec_insert_status.IsError());
const auto &rec_result_set =
dynamic_cast<const UniqueResult &>(rec_transaction->GetResultSet());
const auto &inserted_rec = rec_result_set.GetEntity();
std::cout << inserted_rec.ToString() << std::endl;
EXPECT_EQ(inserted_rec.GetName(), rec.GetName());
EXPECT_EQ(inserted_rec.GetParents().Size(), 1);
EXPECT_EQ(inserted_rec.GetParents().At(0).GetId(), inserted_rt.GetId());
......
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