Skip to content
Snippets Groups Projects
Commit c70ce336 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

MAINT: rename get_env_var to get_env_fallback

parent c10ce9ce
No related branches found
No related tags found
No related merge requests found
Pipeline #12584 passed
......@@ -32,15 +32,13 @@
* @date 2021-07-07
*/
#define EXPECT_THROW_MESSAGE(statement, exeption_type, message) \
EXPECT_THROW( \
try { statement; } catch (const exeption_type &e) { \
EXPECT_THROW(try { statement; } catch (const exeption_type &e) { \
EXPECT_EQ(std::string(e.what()), message); \
throw; \
}, \
exeption_type)
#define ASSERT_THROW_MESSAGE(statement, exeption_type, message) \
ASSERT_THROW( \
try { statement; } catch (const exeption_type &e) { \
ASSERT_THROW(try { statement; } catch (const exeption_type &e) { \
ASSERT_EQ(std::string(e.what()), message); \
throw; \
}, \
......
......@@ -26,7 +26,7 @@
#include "caosdb/constants.h" // for COMPATIBLE_SERVER_VERSION_M...
#include "caosdb/exceptions.h" // for AuthenticationError, Connec...
#include "caosdb/info.h" // for VersionInfo
#include "caosdb/utility.h" // for get_env_var
#include "caosdb/utility.h" // for get_env_fallback
#include "caosdb_test_utility.h" // for EXPECT_THROW_MESSAGE
#include "gtest/gtest_pred_impl.h" // NOLINT TODO how to fix this? for Test, TestInfo, TEST, EXPEC...
#include <gtest/gtest-message.h> // for Message
......@@ -62,10 +62,10 @@ TEST(test_connection, connect_somehost_42347_fails) {
TEST(test_connection, connection_insecure_authentication_error_anonymous) {
const auto *port_str =
caosdb::utility::get_env_var("CAOSDB_SERVER_GRPC_PORT_HTTP", "8080");
caosdb::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTP", "8080");
auto port = std::stoi(port_str);
const auto *const host =
caosdb::utility::get_env_var("CAOSDB_SERVER_HOST", "localhost");
caosdb::utility::get_env_fallback("CAOSDB_SERVER_HOST", "localhost");
auto config = InsecureConnectionConfiguration(host, port);
auto connection = Connection(config);
......@@ -75,12 +75,12 @@ TEST(test_connection, connection_insecure_authentication_error_anonymous) {
TEST(test_connection, connection_ssl_authentication_error_anonymous) {
const auto *port_str =
caosdb::utility::get_env_var("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
caosdb::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
auto port = std::stoi(port_str);
const auto *const host =
caosdb::utility::get_env_var("CAOSDB_SERVER_HOST", "localhost");
caosdb::utility::get_env_fallback("CAOSDB_SERVER_HOST", "localhost");
const auto path =
caosdb::utility::get_env_var("CAOSDB_SERVER_CERT", std::string());
caosdb::utility::get_env_fallback("CAOSDB_SERVER_CERT", std::string());
auto cert = PemFileCertificateProvider(path);
auto config = TlsConnectionConfiguration(host, port, cert);
......@@ -94,12 +94,12 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) {
TEST(test_connection, connection_ssl_authentication_error_wrong_credentials) {
const auto *port_str =
caosdb::utility::get_env_var("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
caosdb::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
auto port = std::stoi(port_str);
const auto *const host =
caosdb::utility::get_env_var("CAOSDB_SERVER_HOST", "localhost");
caosdb::utility::get_env_fallback("CAOSDB_SERVER_HOST", "localhost");
const auto path =
caosdb::utility::get_env_var("CAOSDB_SERVER_CERT", std::string());
caosdb::utility::get_env_fallback("CAOSDB_SERVER_CERT", std::string());
const auto *const user = "not-a-user-23461237";
const auto *const password = "very-c-cred";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment