diff --git a/tests/mysql/test_aggregations.cpp b/tests/mysql/test_aggregations.cpp index 3fb89e5..ab2f8bb 100644 --- a/tests/mysql/test_aggregations.cpp +++ b/tests/mysql/test_aggregations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_aggregations { @@ -27,10 +28,7 @@ TEST(mysql, test_aggregations) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_aggregations_with_nullable.cpp b/tests/mysql/test_aggregations_with_nullable.cpp index ad2415a..908f79f 100644 --- a/tests/mysql/test_aggregations_with_nullable.cpp +++ b/tests/mysql/test_aggregations_with_nullable.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_aggregations_with_nullable { @@ -26,10 +27,7 @@ TEST(mysql, test_aggregations_with_nullable) { Person{.id = 2, .first_name = "Lisa", .last_name = "Simpson", .age = 8}, Person{.id = 3, .first_name = "Maggie", .last_name = "Simpson"}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_auto_incr_primary_key.cpp b/tests/mysql/test_auto_incr_primary_key.cpp index 0173c21..1376e1d 100644 --- a/tests/mysql/test_auto_incr_primary_key.cpp +++ b/tests/mysql/test_auto_incr_primary_key.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_auto_incr_primary_key { @@ -24,10 +25,7 @@ TEST(mysql, test_auto_incr_primary_key) { Person{.first_name = "Lisa", .last_name = "Simpson", .age = 8}, Person{.first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_boolean.cpp b/tests/mysql/test_boolean.cpp index fbf643c..216936b 100644 --- a/tests/mysql/test_boolean.cpp +++ b/tests/mysql/test_boolean.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_boolean { @@ -35,10 +36,7 @@ TEST(mysql, test_boolean) { .last_name = "Simpson", .has_children = false}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_boolean_conditions.cpp b/tests/mysql/test_boolean_conditions.cpp index 8efc394..4f2040e 100644 --- a/tests/mysql/test_boolean_conditions.cpp +++ b/tests/mysql/test_boolean_conditions.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_boolean_conditions { @@ -35,10 +36,7 @@ TEST(mysql, test_boolean_conditions) { .last_name = "Simpson", .has_children = false}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_boolean_update.cpp b/tests/mysql/test_boolean_update.cpp index d3d313b..343939f 100644 --- a/tests/mysql/test_boolean_update.cpp +++ b/tests/mysql/test_boolean_update.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_boolean_update { @@ -35,10 +36,7 @@ TEST(mysql, test_boolean_update) { .last_name = "Simpson", .has_children = false}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_cache.cpp b/tests/mysql/test_cache.cpp index cd54cae..b088e10 100644 --- a/tests/mysql/test_cache.cpp +++ b/tests/mysql/test_cache.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_cache { @@ -16,10 +17,7 @@ struct User { }; TEST(mysql, test_cache) { - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials); diff --git a/tests/mysql/test_create_index.cpp b/tests/mysql/test_create_index.cpp index 73b4843..acecaec 100644 --- a/tests/mysql/test_create_index.cpp +++ b/tests/mysql/test_create_index.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_index { @@ -18,10 +19,7 @@ struct Person { }; TEST(mysql, test_create_index) { - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_create_table.cpp b/tests/mysql/test_create_table.cpp index d869822..9b991cb 100644 --- a/tests/mysql/test_create_table.cpp +++ b/tests/mysql/test_create_table.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_table { @@ -18,10 +19,7 @@ struct Person { }; TEST(mysql, test_create_table) { - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_create_table_as.cpp b/tests/mysql/test_create_table_as.cpp index 07aaf43..ef1c1f4 100644 --- a/tests/mysql/test_create_table_as.cpp +++ b/tests/mysql/test_create_table_as.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_table_as { @@ -23,10 +24,7 @@ struct Name { }; TEST(mysql, test_create_table_as) { - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_create_view_as.cpp b/tests/mysql/test_create_view_as.cpp index 6e75b8b..5d795b8 100644 --- a/tests/mysql/test_create_view_as.cpp +++ b/tests/mysql/test_create_view_as.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_view_as { @@ -28,10 +29,7 @@ struct Name { }; TEST(mysql, test_create_view_as) { - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_delete_from.cpp b/tests/mysql/test_delete_from.cpp index 104cca6..d5484fb 100644 --- a/tests/mysql/test_delete_from.cpp +++ b/tests/mysql/test_delete_from.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_delete_from { @@ -28,10 +29,7 @@ TEST(mysql, test_delete_from) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_dynamic_type.cpp b/tests/mysql/test_dynamic_type.cpp index 9be5ab7..11bae96 100644 --- a/tests/mysql/test_dynamic_type.cpp +++ b/tests/mysql/test_dynamic_type.cpp @@ -11,6 +11,7 @@ #include #include #include +#include "test_helpers.hpp" namespace sqlgen::parsing { @@ -85,10 +86,7 @@ TEST(mysql, test_dynamic_type) { Person{.first_name = "Lisa", .last_name = "Simpson", .age = 8}, Person{.first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_enum_crosstable.cpp b/tests/mysql/test_enum_crosstable.cpp index dbbcead..37ea899 100644 --- a/tests/mysql/test_enum_crosstable.cpp +++ b/tests/mysql/test_enum_crosstable.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_enum_cross_table { enum class AccessRestriction { PUBLIC = 1, INTERNAL = 2, CONFIDENTIAL = 3 }; @@ -69,10 +70,7 @@ TEST(mysql, test_enum_cross_table) { .path = "/documents/powerplant/release_notes.txt"}, }); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = mysql::connect(credentials); conn.and_then(drop | if_exists) .and_then(drop | if_exists); diff --git a/tests/mysql/test_enum_lookup.cpp b/tests/mysql/test_enum_lookup.cpp index 6c8b89e..5bf6afd 100644 --- a/tests/mysql/test_enum_lookup.cpp +++ b/tests/mysql/test_enum_lookup.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_enum_lookup { @@ -49,10 +50,7 @@ TEST(mysql, test_enum_lookup) { .path = "/documents/powerplant/release_notes.txt"}, }); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_enum_namespace.cpp b/tests/mysql/test_enum_namespace.cpp index 28ff5f7..9b343ac 100644 --- a/tests/mysql/test_enum_namespace.cpp +++ b/tests/mysql/test_enum_namespace.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_enum_namespace { namespace first { @@ -36,10 +37,7 @@ TEST(mysql, test_enum_namespace) { .enum_two = second::IdenticallyNamed::VALUE5}, }); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = mysql::connect(credentials); conn.and_then(drop | if_exists); diff --git a/tests/mysql/test_error_handling.cpp b/tests/mysql/test_error_handling.cpp index 94410cc..7cc4820 100644 --- a/tests/mysql/test_error_handling.cpp +++ b/tests/mysql/test_error_handling.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_error_handling { @@ -28,10 +29,7 @@ TEST(mysql, test_error_handling) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_foreign_key.cpp b/tests/mysql/test_foreign_key.cpp index 07c3cb5..1a613e6 100644 --- a/tests/mysql/test_foreign_key.cpp +++ b/tests/mysql/test_foreign_key.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_foreign_key { @@ -39,10 +40,7 @@ TEST(mysql, test_foreign_key) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_group_by.cpp b/tests/mysql/test_group_by.cpp index d20fef3..4082451 100644 --- a/tests/mysql/test_group_by.cpp +++ b/tests/mysql/test_group_by.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_group_by { @@ -27,10 +28,7 @@ TEST(mysql, test_group_by) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_group_by_with_operations.cpp b/tests/mysql/test_group_by_with_operations.cpp index 1e40308..3519d90 100644 --- a/tests/mysql/test_group_by_with_operations.cpp +++ b/tests/mysql/test_group_by_with_operations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_group_by_with_operations { @@ -27,10 +28,7 @@ TEST(mysql, test_group_by_with_operations) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_helpers.hpp b/tests/mysql/test_helpers.hpp new file mode 100644 index 0000000..8d5627b --- /dev/null +++ b/tests/mysql/test_helpers.hpp @@ -0,0 +1,23 @@ +#ifndef SQLGEN_TESTS_MYSQL_TEST_HELPERS_HPP_ +#define SQLGEN_TESTS_MYSQL_TEST_HELPERS_HPP_ + +#include +#include + +namespace sqlgen::mysql::test { + +/// Creates test credentials for MySQL. +/// Set SQLGEN_TEST_PASSWORD environment variable to override the default +/// password ("password"). This allows running tests against an existing +/// database without modifying source code. +inline Credentials make_credentials() { + const char* env_password = std::getenv("SQLGEN_TEST_PASSWORD"); + return Credentials{.host = "localhost", + .user = "sqlgen", + .password = env_password ? env_password : "password", + .dbname = "mysql"}; +} + +} + +#endif diff --git a/tests/mysql/test_in.cpp b/tests/mysql/test_in.cpp index a9a73e0..702ed71 100644 --- a/tests/mysql/test_in.cpp +++ b/tests/mysql/test_in.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_in { @@ -28,10 +29,7 @@ TEST(mysql, test_in) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_in_vec.cpp b/tests/mysql/test_in_vec.cpp index 5be0906..6a66311 100644 --- a/tests/mysql/test_in_vec.cpp +++ b/tests/mysql/test_in_vec.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_in_vec { @@ -28,10 +29,7 @@ TEST(mysql, test_in_vec) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_insert_and_read.cpp b/tests/mysql/test_insert_and_read.cpp index 9ebf1ab..eb8c761 100644 --- a/tests/mysql/test_insert_and_read.cpp +++ b/tests/mysql/test_insert_and_read.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_and_read { @@ -26,10 +27,7 @@ TEST(mysql, test_insert_and_read) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_insert_and_read_two_tables.cpp b/tests/mysql/test_insert_and_read_two_tables.cpp index ad8a436..410154d 100644 --- a/tests/mysql/test_insert_and_read_two_tables.cpp +++ b/tests/mysql/test_insert_and_read_two_tables.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_and_read_two_tables { @@ -36,10 +37,7 @@ TEST(mysql, test_insert_and_read_two_tables) { Children{.id_parent = 0, .id_child = 2}, Children{.id_parent = 0, .id_child = 3}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_insert_fail.cpp b/tests/mysql/test_insert_fail.cpp index 2b10ec6..d38d46f 100644 --- a/tests/mysql/test_insert_fail.cpp +++ b/tests/mysql/test_insert_fail.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_fail { @@ -27,10 +28,7 @@ TEST(mysql, test_insert_fail) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_insert_or_replace.cpp b/tests/mysql/test_insert_or_replace.cpp index ed3da72..079c3a3 100644 --- a/tests/mysql/test_insert_or_replace.cpp +++ b/tests/mysql/test_insert_or_replace.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_or_replace { @@ -51,10 +52,7 @@ TEST(mysql, test_insert_or_replace) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto people4 = sqlgen::mysql::connect(credentials) diff --git a/tests/mysql/test_is_null.cpp b/tests/mysql/test_is_null.cpp index 211c72b..6aed670 100644 --- a/tests/mysql/test_is_null.cpp +++ b/tests/mysql/test_is_null.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_is_null { @@ -26,10 +27,7 @@ TEST(mysql, test_is_null) { .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}, Person{.id = 4, .first_name = "Hugo", .last_name = "Simpson"}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_join.cpp b/tests/mysql/test_join.cpp index 13fe86d..eefb690 100644 --- a/tests/mysql/test_join.cpp +++ b/tests/mysql/test_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_join { @@ -27,10 +28,7 @@ TEST(mysql, test_join) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_joins_from.cpp b/tests/mysql/test_joins_from.cpp index 8a5054a..9433d31 100644 --- a/tests/mysql/test_joins_from.cpp +++ b/tests/mysql/test_joins_from.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_from { @@ -42,10 +43,7 @@ TEST(mysql, test_joins_from) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_joins_nested.cpp b/tests/mysql/test_joins_nested.cpp index 09829f0..290e29c 100644 --- a/tests/mysql/test_joins_nested.cpp +++ b/tests/mysql/test_joins_nested.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_nested { @@ -42,10 +43,7 @@ TEST(mysql, test_joins_nested) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_joins_nested_grouped.cpp b/tests/mysql/test_joins_nested_grouped.cpp index b1e5d91..73f8d69 100644 --- a/tests/mysql/test_joins_nested_grouped.cpp +++ b/tests/mysql/test_joins_nested_grouped.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_nested_grouped { @@ -42,10 +43,7 @@ TEST(mysql, test_joins_nested_grouped) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_joins_two_tables.cpp b/tests/mysql/test_joins_two_tables.cpp index bed3892..1355843 100644 --- a/tests/mysql/test_joins_two_tables.cpp +++ b/tests/mysql/test_joins_two_tables.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_two_tables { @@ -42,10 +43,7 @@ TEST(mysql, test_joins_two_tables) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_joins_two_tables_grouped.cpp b/tests/mysql/test_joins_two_tables_grouped.cpp index b0729b9..d864211 100644 --- a/tests/mysql/test_joins_two_tables_grouped.cpp +++ b/tests/mysql/test_joins_two_tables_grouped.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_two_tables_grouped { @@ -42,10 +43,7 @@ TEST(mysql, test_joins_two_tables_grouped) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_json.cpp b/tests/mysql/test_json.cpp index a4a3243..e59ea52 100644 --- a/tests/mysql/test_json.cpp +++ b/tests/mysql/test_json.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_json { @@ -28,10 +29,7 @@ TEST(mysql, test_json) { .age = 45, .children = children}; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_left_join.cpp b/tests/mysql/test_left_join.cpp index fdaf972..9578f7a 100644 --- a/tests/mysql/test_left_join.cpp +++ b/tests/mysql/test_left_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_left_join { @@ -37,10 +38,7 @@ TEST(mysql, test_left_join) { Pet{.id = 3, .name = "Mr. Teeny", .owner_id = 99}, }); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_like.cpp b/tests/mysql/test_like.cpp index e63515a..5172e4e 100644 --- a/tests/mysql/test_like.cpp +++ b/tests/mysql/test_like.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_like { @@ -28,10 +29,7 @@ TEST(mysql, test_like) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_limit.cpp b/tests/mysql/test_limit.cpp index 22f46c2..e7e1182 100644 --- a/tests/mysql/test_limit.cpp +++ b/tests/mysql/test_limit.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_limit { @@ -28,10 +29,7 @@ TEST(mysql, test_limit) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_not_in.cpp b/tests/mysql/test_not_in.cpp index af0d47f..0541dfa 100644 --- a/tests/mysql/test_not_in.cpp +++ b/tests/mysql/test_not_in.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_not_in { @@ -28,10 +29,7 @@ TEST(mysql, test_not_in) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_not_in_vec.cpp b/tests/mysql/test_not_in_vec.cpp index 3328a25..2fe638a 100644 --- a/tests/mysql/test_not_in_vec.cpp +++ b/tests/mysql/test_not_in_vec.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_not_in_vec { @@ -28,10 +29,7 @@ TEST(mysql, test_not_in_vec) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_offset.cpp b/tests/mysql/test_offset.cpp index 7bd857d..2249469 100644 --- a/tests/mysql/test_offset.cpp +++ b/tests/mysql/test_offset.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_offset { @@ -28,10 +29,7 @@ TEST(mysql, test_offset) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_operations.cpp b/tests/mysql/test_operations.cpp index 9739dbb..2562cfe 100644 --- a/tests/mysql/test_operations.cpp +++ b/tests/mysql/test_operations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_operations { @@ -27,10 +28,7 @@ TEST(mysql, test_operations) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_operations_with_nullable.cpp b/tests/mysql/test_operations_with_nullable.cpp index aa568df..5593921 100644 --- a/tests/mysql/test_operations_with_nullable.cpp +++ b/tests/mysql/test_operations_with_nullable.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_operations_with_nullable { @@ -28,10 +29,7 @@ TEST(mysql, test_operations_with_nullable) { Person{ .id = 4, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_range.cpp b/tests/mysql/test_range.cpp index 2accd13..4b8bda4 100644 --- a/tests/mysql/test_range.cpp +++ b/tests/mysql/test_range.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range { @@ -27,10 +28,7 @@ TEST(mysql, test_range) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_range_select_from.cpp b/tests/mysql/test_range_select_from.cpp index 5a9e81e..86f1e9e 100644 --- a/tests/mysql/test_range_select_from.cpp +++ b/tests/mysql/test_range_select_from.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range_select_from { @@ -27,10 +28,7 @@ TEST(mysql, test_range_select_from) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_right_join.cpp b/tests/mysql/test_right_join.cpp index 719b67f..f60cbfa 100644 --- a/tests/mysql/test_right_join.cpp +++ b/tests/mysql/test_right_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_right_join { @@ -37,10 +38,7 @@ TEST(mysql, test_right_join) { Pet{.id = 3, .name = "Mr. Teeny", .owner_id = 99}, }); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_select_from_with_timestamps.cpp b/tests/mysql/test_select_from_with_timestamps.cpp index 449d3b2..10bd8dd 100644 --- a/tests/mysql/test_select_from_with_timestamps.cpp +++ b/tests/mysql/test_select_from_with_timestamps.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_select_from_with_timestamps { @@ -34,10 +35,7 @@ TEST(mysql, test_select_from_with_timestamps) { .last_name = "Simpson", .birthday = sqlgen::Date("2010-01-01")}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_select_from_with_to.cpp b/tests/mysql/test_select_from_with_to.cpp index 44948c2..f87e67e 100644 --- a/tests/mysql/test_select_from_with_to.cpp +++ b/tests/mysql/test_select_from_with_to.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range_select_from_with_to { @@ -27,10 +28,7 @@ TEST(mysql, test_range_select_from) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_timestamp.cpp b/tests/mysql/test_timestamp.cpp index e33f690..fc972d2 100644 --- a/tests/mysql/test_timestamp.cpp +++ b/tests/mysql/test_timestamp.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_timestamp { @@ -25,10 +26,7 @@ TEST(mysql, test_timestamp) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials).and_then(drop | if_exists); diff --git a/tests/mysql/test_transaction.cpp b/tests/mysql/test_transaction.cpp index 46abbd4..c99d72f 100644 --- a/tests/mysql/test_transaction.cpp +++ b/tests/mysql/test_transaction.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_transaction { @@ -28,10 +29,7 @@ TEST(mysql, test_transaction) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_union.cpp b/tests/mysql/test_union.cpp index b51d66e..d0ad446 100644 --- a/tests/mysql/test_union.cpp +++ b/tests/mysql/test_union.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_union { @@ -28,10 +29,7 @@ struct User3 { TEST(mysql, test_union) { using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/mysql/test_union_all.cpp b/tests/mysql/test_union_all.cpp index 0c65662..1cab57c 100644 --- a/tests/mysql/test_union_all.cpp +++ b/tests/mysql/test_union_all.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/mysql/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_all { @@ -30,10 +31,7 @@ struct User3 { TEST(mysql, test_union_all) { using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/mysql/test_union_in_join.cpp b/tests/mysql/test_union_in_join.cpp index a644275..1a958f8 100644 --- a/tests/mysql/test_union_in_join.cpp +++ b/tests/mysql/test_union_in_join.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/mysql/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_in_join { @@ -36,10 +37,7 @@ TEST(mysql, test_union_in_join) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/mysql/test_union_in_join2.cpp b/tests/mysql/test_union_in_join2.cpp index e52599a..ddfb4ec 100644 --- a/tests/mysql/test_union_in_join2.cpp +++ b/tests/mysql/test_union_in_join2.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/mysql/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_in_join2 { @@ -36,10 +37,7 @@ TEST(mysql, test_union_in_join2) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/mysql/test_union_in_select.cpp b/tests/mysql/test_union_in_select.cpp index e3ce389..f90d064 100644 --- a/tests/mysql/test_union_in_select.cpp +++ b/tests/mysql/test_union_in_select.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/mysql/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_in_select { @@ -30,10 +31,7 @@ struct User3 { TEST(mysql, test_union_in_select) { using namespace sqlgen::literals; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = sqlgen::mysql::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/mysql/test_unique.cpp b/tests/mysql/test_unique.cpp index 868179f..ad7dc46 100644 --- a/tests/mysql/test_unique.cpp +++ b/tests/mysql/test_unique.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_unique { @@ -29,10 +30,7 @@ TEST(mysql, test_unique) { Person{ .id = 4, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_update.cpp b/tests/mysql/test_update.cpp index 0489d77..5ef809e 100644 --- a/tests/mysql/test_update.cpp +++ b/tests/mysql/test_update.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_update { @@ -28,10 +29,7 @@ TEST(mysql, test_update) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_update_with_optional.cpp b/tests/mysql/test_update_with_optional.cpp index df6fd23..ad3c629 100644 --- a/tests/mysql/test_update_with_optional.cpp +++ b/tests/mysql/test_update_with_optional.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_update_with_optional { @@ -28,10 +29,7 @@ TEST(mysql, test_update_with_optional) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_varchar.cpp b/tests/mysql/test_varchar.cpp index be22cef..bcc73e7 100644 --- a/tests/mysql/test_varchar.cpp +++ b/tests/mysql/test_varchar.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_varchar { @@ -27,10 +28,7 @@ TEST(mysql, test_varchar) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_where.cpp b/tests/mysql/test_where.cpp index 08da07a..c27a306 100644 --- a/tests/mysql/test_where.cpp +++ b/tests/mysql/test_where.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_where { @@ -28,10 +29,7 @@ TEST(mysql, test_where) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_where_with_operations.cpp b/tests/mysql/test_where_with_operations.cpp index cb3d98e..d1b46fc 100644 --- a/tests/mysql/test_where_with_operations.cpp +++ b/tests/mysql/test_where_with_operations.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_where_with_operations { @@ -28,10 +29,7 @@ TEST(mysql, test_where_with_operations) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_where_with_timestamps.cpp b/tests/mysql/test_where_with_timestamps.cpp index 2810053..d66685f 100644 --- a/tests/mysql/test_where_with_timestamps.cpp +++ b/tests/mysql/test_where_with_timestamps.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_where_with_timestamps { @@ -33,10 +34,7 @@ TEST(mysql, test_where_with_timestamps) { .last_name = "Simpson", .birthday = sqlgen::Date("2010-01-01")}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_write_and_read.cpp b/tests/mysql/test_write_and_read.cpp index 30c7994..bc40a51 100644 --- a/tests/mysql/test_write_and_read.cpp +++ b/tests/mysql/test_write_and_read.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_write_and_read { @@ -28,10 +29,7 @@ TEST(mysql, test_write_and_read) { using namespace sqlgen; - const auto credentials = mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto conn = mysql::connect(credentials).and_then(drop | if_exists); diff --git a/tests/mysql/test_write_and_read_curried.cpp b/tests/mysql/test_write_and_read_curried.cpp index 5c3f3ad..53d93e5 100644 --- a/tests/mysql/test_write_and_read_curried.cpp +++ b/tests/mysql/test_write_and_read_curried.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_write_and_read_curried { @@ -26,10 +27,7 @@ TEST(mysql, test_write_and_read_curried) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/mysql/test_write_and_read_pool.cpp b/tests/mysql/test_write_and_read_pool.cpp index dd2bcfe..0e49a90 100644 --- a/tests/mysql/test_write_and_read_pool.cpp +++ b/tests/mysql/test_write_and_read_pool.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_write_and_read_pool { @@ -28,10 +29,7 @@ TEST(mysql, test_write_and_read_pool) { const auto pool_config = sqlgen::ConnectionPoolConfig{.size = 2}; - const auto credentials = sqlgen::mysql::Credentials{.host = "localhost", - .user = "sqlgen", - .password = "password", - .dbname = "mysql"}; + const auto credentials = sqlgen::mysql::test::make_credentials(); const auto pool = sqlgen::make_connection_pool( pool_config, credentials); diff --git a/tests/postgres/test_aggregations.cpp b/tests/postgres/test_aggregations.cpp index fd2731e..455803b 100644 --- a/tests/postgres/test_aggregations.cpp +++ b/tests/postgres/test_aggregations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_aggregations { @@ -27,10 +28,7 @@ TEST(postgres, test_aggregations) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_aggregations_with_nullable.cpp b/tests/postgres/test_aggregations_with_nullable.cpp index 5ca1da2..d55fb05 100644 --- a/tests/postgres/test_aggregations_with_nullable.cpp +++ b/tests/postgres/test_aggregations_with_nullable.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_aggregations_with_nullable { @@ -26,10 +27,7 @@ TEST(postgres, test_aggregations_with_nullable) { Person{.id = 2, .first_name = "Lisa", .last_name = "Simpson", .age = 8}, Person{.id = 3, .first_name = "Maggie", .last_name = "Simpson"}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_auto_incr_primary_key.cpp b/tests/postgres/test_auto_incr_primary_key.cpp index 3422e89..5ba461f 100644 --- a/tests/postgres/test_auto_incr_primary_key.cpp +++ b/tests/postgres/test_auto_incr_primary_key.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_auto_incr_primary_key { @@ -24,10 +25,7 @@ TEST(postgres, test_auto_incr_primary_key) { Person{.first_name = "Lisa", .last_name = "Simpson", .age = 8}, Person{.first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_boolean.cpp b/tests/postgres/test_boolean.cpp index 59a79d2..1406e24 100644 --- a/tests/postgres/test_boolean.cpp +++ b/tests/postgres/test_boolean.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_boolean { @@ -35,10 +36,7 @@ TEST(postgres, test_boolean) { .last_name = "Simpson", .has_children = false}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_boolean_conditions.cpp b/tests/postgres/test_boolean_conditions.cpp index f0b4c6b..d09b853 100644 --- a/tests/postgres/test_boolean_conditions.cpp +++ b/tests/postgres/test_boolean_conditions.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_boolean_conditions { @@ -35,10 +36,7 @@ TEST(postgres, test_boolean_conditions) { .last_name = "Simpson", .has_children = false}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_boolean_update.cpp b/tests/postgres/test_boolean_update.cpp index 69bdfb8..c3ac424 100644 --- a/tests/postgres/test_boolean_update.cpp +++ b/tests/postgres/test_boolean_update.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_boolean_update { @@ -35,10 +36,7 @@ TEST(postgres, test_boolean_update) { .last_name = "Simpson", .has_children = false}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_cache.cpp b/tests/postgres/test_cache.cpp index 5972206..c38d2a0 100644 --- a/tests/postgres/test_cache.cpp +++ b/tests/postgres/test_cache.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_cache { @@ -16,10 +17,7 @@ struct User { }; TEST(postgres, test_cache) { - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials); diff --git a/tests/postgres/test_create_index.cpp b/tests/postgres/test_create_index.cpp index fb15f2b..53422d1 100644 --- a/tests/postgres/test_create_index.cpp +++ b/tests/postgres/test_create_index.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_index { @@ -18,10 +19,7 @@ struct Person { }; TEST(postgres, test_create_index) { - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_create_index_where.cpp b/tests/postgres/test_create_index_where.cpp index 8226801..b765bff 100644 --- a/tests/postgres/test_create_index_where.cpp +++ b/tests/postgres/test_create_index_where.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_index_where { @@ -18,10 +19,7 @@ struct Person { }; TEST(postgres, test_create_index_where) { - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_create_table.cpp b/tests/postgres/test_create_table.cpp index 7b61cd5..6ce244e 100644 --- a/tests/postgres/test_create_table.cpp +++ b/tests/postgres/test_create_table.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_table { @@ -18,10 +19,7 @@ struct Person { }; TEST(postgres, test_create_table) { - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_create_table_as.cpp b/tests/postgres/test_create_table_as.cpp index 8d1fd19..93a0610 100644 --- a/tests/postgres/test_create_table_as.cpp +++ b/tests/postgres/test_create_table_as.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_table_as { @@ -23,10 +24,7 @@ struct Name { }; TEST(postgres, test_create_table_as) { - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_create_view_as.cpp b/tests/postgres/test_create_view_as.cpp index 092f9c4..1762f43 100644 --- a/tests/postgres/test_create_view_as.cpp +++ b/tests/postgres/test_create_view_as.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_create_view_as { @@ -28,10 +29,7 @@ struct Name { }; TEST(postgres, test_create_view_as) { - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_delete_from.cpp b/tests/postgres/test_delete_from.cpp index c31ba57..10d1a7d 100644 --- a/tests/postgres/test_delete_from.cpp +++ b/tests/postgres/test_delete_from.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_delete_from { @@ -28,10 +29,7 @@ TEST(postgres, test_delete_from) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_dynamic_type.cpp b/tests/postgres/test_dynamic_type.cpp index 1afeb23..f835295 100644 --- a/tests/postgres/test_dynamic_type.cpp +++ b/tests/postgres/test_dynamic_type.cpp @@ -11,6 +11,7 @@ #include #include #include +#include "test_helpers.hpp" namespace sqlgen::parsing { @@ -85,10 +86,7 @@ TEST(postgres, test_dynamic_type) { Person{.first_name = "Lisa", .last_name = "Simpson", .age = 8}, Person{.first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_enum_crosstable.cpp b/tests/postgres/test_enum_crosstable.cpp index 460cb6e..7431502 100644 --- a/tests/postgres/test_enum_crosstable.cpp +++ b/tests/postgres/test_enum_crosstable.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_enum_cross_table { enum class AccessRestriction { PUBLIC = 1, INTERNAL = 2, CONFIDENTIAL = 3 }; @@ -69,10 +70,7 @@ TEST(postgres, test_enum_cross_table) { .path = "/documents/powerplant/release_notes.txt"}, }); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = postgres::connect(credentials); conn.and_then(drop | if_exists) .and_then(drop | if_exists); diff --git a/tests/postgres/test_enum_lookup.cpp b/tests/postgres/test_enum_lookup.cpp index 8a8d5bd..918bcd4 100644 --- a/tests/postgres/test_enum_lookup.cpp +++ b/tests/postgres/test_enum_lookup.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_enum_lookup { @@ -49,10 +50,7 @@ TEST(postgres, test_enum_lookup) { .path = "/documents/powerplant/release_notes.txt"}, }); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_enum_namespace.cpp b/tests/postgres/test_enum_namespace.cpp index 86dfc47..60385e4 100644 --- a/tests/postgres/test_enum_namespace.cpp +++ b/tests/postgres/test_enum_namespace.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_enum_namespace { namespace first { @@ -36,10 +37,7 @@ TEST(postgres, test_enum_namespace) { .enum_two = second::IdenticallyNamed::VALUE5}, }); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = postgres::connect(credentials); conn.and_then(drop | if_exists); diff --git a/tests/postgres/test_error_handling.cpp b/tests/postgres/test_error_handling.cpp index 3f45324..d3adb34 100644 --- a/tests/postgres/test_error_handling.cpp +++ b/tests/postgres/test_error_handling.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_error_handling { @@ -28,10 +29,7 @@ TEST(postgres, test_error_handling) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_foreign_key.cpp b/tests/postgres/test_foreign_key.cpp index 22f17e6..2e2e921 100644 --- a/tests/postgres/test_foreign_key.cpp +++ b/tests/postgres/test_foreign_key.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_foreign_key { @@ -39,10 +40,7 @@ TEST(postgres, test_foreign_key) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_full_join.cpp b/tests/postgres/test_full_join.cpp index a828c81..7eb21ac 100644 --- a/tests/postgres/test_full_join.cpp +++ b/tests/postgres/test_full_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_full_join { @@ -37,10 +38,7 @@ TEST(postgres, test_full_join) { Pet{.id = 3, .name = "Mr. Teeny", .owner_id = 99}, }); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_group_by.cpp b/tests/postgres/test_group_by.cpp index 2fa440f..fa95acc 100644 --- a/tests/postgres/test_group_by.cpp +++ b/tests/postgres/test_group_by.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_group_by { @@ -27,10 +28,7 @@ TEST(postgres, test_group_by) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_group_by_with_operations.cpp b/tests/postgres/test_group_by_with_operations.cpp index a670a28..a7f4919 100644 --- a/tests/postgres/test_group_by_with_operations.cpp +++ b/tests/postgres/test_group_by_with_operations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_group_by_with_operations { @@ -27,10 +28,7 @@ TEST(postgres, test_group_by) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_helpers.hpp b/tests/postgres/test_helpers.hpp new file mode 100644 index 0000000..3f46ba9 --- /dev/null +++ b/tests/postgres/test_helpers.hpp @@ -0,0 +1,23 @@ +#ifndef SQLGEN_TESTS_POSTGRES_TEST_HELPERS_HPP_ +#define SQLGEN_TESTS_POSTGRES_TEST_HELPERS_HPP_ + +#include +#include + +namespace sqlgen::postgres::test { + +/// Creates test credentials for PostgreSQL. +/// Set SQLGEN_TEST_PASSWORD environment variable to override the default +/// password ("password"). This allows running tests against an existing +/// database without modifying source code. +inline Credentials make_credentials() { + const char* env_password = std::getenv("SQLGEN_TEST_PASSWORD"); + return Credentials{.user = "postgres", + .password = env_password ? env_password : "password", + .host = "localhost", + .dbname = "postgres"}; +} + +} + +#endif diff --git a/tests/postgres/test_in.cpp b/tests/postgres/test_in.cpp index b48a0cd..ac1eac7 100644 --- a/tests/postgres/test_in.cpp +++ b/tests/postgres/test_in.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_in { @@ -28,10 +29,7 @@ TEST(postgres, test_in) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_in_vec.cpp b/tests/postgres/test_in_vec.cpp index d579ead..6864c2a 100644 --- a/tests/postgres/test_in_vec.cpp +++ b/tests/postgres/test_in_vec.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_in_vec { @@ -28,10 +29,7 @@ TEST(postgres, test_in_vec) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_insert_and_read.cpp b/tests/postgres/test_insert_and_read.cpp index f01c637..1768888 100644 --- a/tests/postgres/test_insert_and_read.cpp +++ b/tests/postgres/test_insert_and_read.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_and_read { @@ -26,10 +27,7 @@ TEST(postgres, test_insert_and_read) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_insert_and_read_two_tables.cpp b/tests/postgres/test_insert_and_read_two_tables.cpp index 8fbf05d..a883af0 100644 --- a/tests/postgres/test_insert_and_read_two_tables.cpp +++ b/tests/postgres/test_insert_and_read_two_tables.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_and_read_two_tables { @@ -36,10 +37,7 @@ TEST(postgres, test_insert_and_read_two_tables) { Children{.id_parent = 0, .id_child = 2}, Children{.id_parent = 0, .id_child = 3}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_insert_fail.cpp b/tests/postgres/test_insert_fail.cpp index 38f52a6..338c16d 100644 --- a/tests/postgres/test_insert_fail.cpp +++ b/tests/postgres/test_insert_fail.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_fail { @@ -27,10 +28,7 @@ TEST(postgres, test_insert_fail) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_insert_or_replace.cpp b/tests/postgres/test_insert_or_replace.cpp index c40864a..4b76d3c 100644 --- a/tests/postgres/test_insert_or_replace.cpp +++ b/tests/postgres/test_insert_or_replace.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_insert_or_replace { @@ -51,10 +52,7 @@ TEST(postgres, test_insert_or_replace) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto people4 = sqlgen::postgres::connect(credentials) diff --git a/tests/postgres/test_is_null.cpp b/tests/postgres/test_is_null.cpp index b444d55..853e77f 100644 --- a/tests/postgres/test_is_null.cpp +++ b/tests/postgres/test_is_null.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_is_null { @@ -26,10 +27,7 @@ TEST(postgres, test_is_null) { .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}, Person{.id = 4, .first_name = "Hugo", .last_name = "Simpson"}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_join.cpp b/tests/postgres/test_join.cpp index df0071b..126aa65 100644 --- a/tests/postgres/test_join.cpp +++ b/tests/postgres/test_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_join { @@ -27,10 +28,7 @@ TEST(postgres, test_join) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_joins_from.cpp b/tests/postgres/test_joins_from.cpp index 7bf5a90..1df0c7f 100644 --- a/tests/postgres/test_joins_from.cpp +++ b/tests/postgres/test_joins_from.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_from { @@ -42,10 +43,7 @@ TEST(postgres, test_joins_from) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_joins_nested.cpp b/tests/postgres/test_joins_nested.cpp index 8ba6cd2..31a7aae 100644 --- a/tests/postgres/test_joins_nested.cpp +++ b/tests/postgres/test_joins_nested.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_nested { @@ -42,10 +43,7 @@ TEST(postgres, test_joins_nested) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_joins_nested_grouped.cpp b/tests/postgres/test_joins_nested_grouped.cpp index dd23f13..301fefe 100644 --- a/tests/postgres/test_joins_nested_grouped.cpp +++ b/tests/postgres/test_joins_nested_grouped.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_nested_grouped { @@ -42,10 +43,7 @@ TEST(postgres, test_joins_nested_grouped) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_joins_two_tables.cpp b/tests/postgres/test_joins_two_tables.cpp index 5faeb3d..9b4ad50 100644 --- a/tests/postgres/test_joins_two_tables.cpp +++ b/tests/postgres/test_joins_two_tables.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_two_tables { @@ -42,10 +43,7 @@ TEST(postgres, test_joins_two_tables) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_joins_two_tables_grouped.cpp b/tests/postgres/test_joins_two_tables_grouped.cpp index 29b4e63..4a8f18b 100644 --- a/tests/postgres/test_joins_two_tables_grouped.cpp +++ b/tests/postgres/test_joins_two_tables_grouped.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_joins_two_tables_grouped { @@ -42,10 +43,7 @@ TEST(postgres, test_joins_two_tables_grouped) { Relationship{.parent_id = 1, .child_id = 3}, Relationship{.parent_id = 1, .child_id = 4}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_json.cpp b/tests/postgres/test_json.cpp index 66c5155..9bb0210 100644 --- a/tests/postgres/test_json.cpp +++ b/tests/postgres/test_json.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_json { @@ -28,10 +29,7 @@ TEST(postgres, test_json) { .age = 45, .children = children}; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_left_join.cpp b/tests/postgres/test_left_join.cpp index 01113f4..aa413d2 100644 --- a/tests/postgres/test_left_join.cpp +++ b/tests/postgres/test_left_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_left_join { @@ -37,10 +38,7 @@ TEST(postgres, test_left_join) { Pet{.id = 3, .name = "Mr. Teeny", .owner_id = 99}, }); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_like.cpp b/tests/postgres/test_like.cpp index 462a08d..3a408ef 100644 --- a/tests/postgres/test_like.cpp +++ b/tests/postgres/test_like.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_like { @@ -28,10 +29,7 @@ TEST(postgres, test_like) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_limit.cpp b/tests/postgres/test_limit.cpp index 6934490..b9bc270 100644 --- a/tests/postgres/test_limit.cpp +++ b/tests/postgres/test_limit.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_limit { @@ -28,10 +29,7 @@ TEST(postgres, test_limit) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_listen_notify.cpp b/tests/postgres/test_listen_notify.cpp index 73644b4..2861a89 100644 --- a/tests/postgres/test_listen_notify.cpp +++ b/tests/postgres/test_listen_notify.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_listen_notify { @@ -35,10 +36,7 @@ TEST(postgres, basic_listen_notify) { using namespace sqlgen; using namespace sqlgen::postgres; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); auto listener_result = sqlgen::postgres::connect(credentials); auto sender_result = sqlgen::postgres::connect(credentials); @@ -69,10 +67,7 @@ TEST(postgres, notify_without_listener_is_silent) { using namespace sqlgen; using namespace sqlgen::postgres; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); auto sender_result = sqlgen::postgres::connect(credentials); @@ -89,10 +84,7 @@ TEST(postgres, InvalidChannelNameRejected) { using namespace sqlgen; using namespace sqlgen::postgres; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); auto listener_result = sqlgen::postgres::connect(credentials); auto sender_result = sqlgen::postgres::connect(credentials); @@ -123,10 +115,7 @@ TEST(postgres, unlisten_star) { using namespace sqlgen; using namespace sqlgen::postgres; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); auto listener_result = sqlgen::postgres::connect(credentials); @@ -149,10 +138,7 @@ TEST(postgres, multiple_notifications_in_burst) { using namespace sqlgen; using namespace sqlgen::postgres; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); auto listener_result = sqlgen::postgres::connect(credentials); auto sender_result = sqlgen::postgres::connect(credentials); diff --git a/tests/postgres/test_not_in.cpp b/tests/postgres/test_not_in.cpp index 12ee883..dd8009d 100644 --- a/tests/postgres/test_not_in.cpp +++ b/tests/postgres/test_not_in.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_not_in { @@ -28,10 +29,7 @@ TEST(postgres, test_not_in) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_not_in_vec.cpp b/tests/postgres/test_not_in_vec.cpp index 2b52a56..52371de 100644 --- a/tests/postgres/test_not_in_vec.cpp +++ b/tests/postgres/test_not_in_vec.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_not_in_vec { @@ -28,10 +29,7 @@ TEST(postgres, test_not_in_vec) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_offset.cpp b/tests/postgres/test_offset.cpp index 4900f16..d31af87 100644 --- a/tests/postgres/test_offset.cpp +++ b/tests/postgres/test_offset.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_offset { @@ -28,10 +29,7 @@ TEST(postgres, test_offset) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_operations.cpp b/tests/postgres/test_operations.cpp index ef33820..4d6030c 100644 --- a/tests/postgres/test_operations.cpp +++ b/tests/postgres/test_operations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_operations { @@ -27,10 +28,7 @@ TEST(postgres, test_operations) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_operations_with_nullable.cpp b/tests/postgres/test_operations_with_nullable.cpp index 191f871..bc41380 100644 --- a/tests/postgres/test_operations_with_nullable.cpp +++ b/tests/postgres/test_operations_with_nullable.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_operations_with_nullable { @@ -28,10 +29,7 @@ TEST(postgres, test_operations_with_nullable) { Person{ .id = 4, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_range.cpp b/tests/postgres/test_range.cpp index 4d76290..26d9f23 100644 --- a/tests/postgres/test_range.cpp +++ b/tests/postgres/test_range.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range { @@ -27,10 +28,7 @@ TEST(postgres, test_range) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_range_select_from.cpp b/tests/postgres/test_range_select_from.cpp index 2060598..12c6715 100644 --- a/tests/postgres/test_range_select_from.cpp +++ b/tests/postgres/test_range_select_from.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range_select_from { @@ -27,10 +28,7 @@ TEST(postgres, test_range_select_from) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_right_join.cpp b/tests/postgres/test_right_join.cpp index 6f84f16..2f432b7 100644 --- a/tests/postgres/test_right_join.cpp +++ b/tests/postgres/test_right_join.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_right_join { @@ -37,10 +38,7 @@ TEST(postgres, test_right_join) { Pet{.id = 3, .name = "Mr. Teeny", .owner_id = 99}, }); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_select_from_with_sessions.cpp b/tests/postgres/test_select_from_with_sessions.cpp index 3231371..1e998ea 100644 --- a/tests/postgres/test_select_from_with_sessions.cpp +++ b/tests/postgres/test_select_from_with_sessions.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range_select_from_with_sessions { @@ -36,10 +37,7 @@ TEST(postgres, test_range_select_from_with_sessions) { const auto pool_config = sqlgen::ConnectionPoolConfig{.size = 2}; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto pool = sqlgen::make_connection_pool( pool_config, credentials); diff --git a/tests/postgres/test_select_from_with_timestamps.cpp b/tests/postgres/test_select_from_with_timestamps.cpp index 88e910c..479d69b 100644 --- a/tests/postgres/test_select_from_with_timestamps.cpp +++ b/tests/postgres/test_select_from_with_timestamps.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range_select_from_with_timestamps { @@ -34,10 +35,7 @@ TEST(postgres, test_range_select_from_with_timestamps) { .last_name = "Simpson", .birthday = sqlgen::Timestamp<"%Y-%m-%d">("2010-01-01")}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_select_from_with_to.cpp b/tests/postgres/test_select_from_with_to.cpp index 9ed1342..ad19ab4 100644 --- a/tests/postgres/test_select_from_with_to.cpp +++ b/tests/postgres/test_select_from_with_to.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_range_select_from_with_to { @@ -27,10 +28,7 @@ TEST(postgres, test_range_select_from) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_timestamp.cpp b/tests/postgres/test_timestamp.cpp index a955ef9..6fd76b0 100644 --- a/tests/postgres/test_timestamp.cpp +++ b/tests/postgres/test_timestamp.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_timestamp { @@ -25,10 +26,7 @@ TEST(postgres, test_timestamp) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials).and_then(drop | if_exists); diff --git a/tests/postgres/test_timestamp_with_tz.cpp b/tests/postgres/test_timestamp_with_tz.cpp index 2abff86..5552440 100644 --- a/tests/postgres/test_timestamp_with_tz.cpp +++ b/tests/postgres/test_timestamp_with_tz.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_timestamp_with_tz { @@ -25,10 +26,7 @@ TEST(postgres, test_timestamp_with_tz) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto people2 = postgres::connect(credentials) .and_then(exec("SET TIME ZONE 'UTC';")) diff --git a/tests/postgres/test_transaction.cpp b/tests/postgres/test_transaction.cpp index 62ffdc9..dbb39f5 100644 --- a/tests/postgres/test_transaction.cpp +++ b/tests/postgres/test_transaction.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_transaction { @@ -28,10 +29,7 @@ TEST(postgres, test_transaction) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_union.cpp b/tests/postgres/test_union.cpp index 8ce15d4..9c53ef0 100644 --- a/tests/postgres/test_union.cpp +++ b/tests/postgres/test_union.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/postgres/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union { @@ -30,10 +31,7 @@ struct User3 { TEST(postgres, test_union) { using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/postgres/test_union_all.cpp b/tests/postgres/test_union_all.cpp index 6190a7e..80066e2 100644 --- a/tests/postgres/test_union_all.cpp +++ b/tests/postgres/test_union_all.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/postgres/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_all { @@ -30,10 +31,7 @@ struct User3 { TEST(postgres, test_union_all) { using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/postgres/test_union_in_join.cpp b/tests/postgres/test_union_in_join.cpp index 910eb38..7320aae 100644 --- a/tests/postgres/test_union_in_join.cpp +++ b/tests/postgres/test_union_in_join.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/postgres/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_in_join { @@ -36,10 +37,7 @@ TEST(postgres, test_union_in_join) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/postgres/test_union_in_join2.cpp b/tests/postgres/test_union_in_join2.cpp index 60ce6df..ffe7446 100644 --- a/tests/postgres/test_union_in_join2.cpp +++ b/tests/postgres/test_union_in_join2.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/postgres/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_in_join2 { @@ -36,10 +37,7 @@ TEST(postgres, test_union_in_join2) { using namespace sqlgen; using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/postgres/test_union_in_select.cpp b/tests/postgres/test_union_in_select.cpp index 51b219b..14d47a7 100644 --- a/tests/postgres/test_union_in_select.cpp +++ b/tests/postgres/test_union_in_select.cpp @@ -9,6 +9,7 @@ #include #include "sqlgen/postgres/to_sql.hpp" +#include "test_helpers.hpp" namespace test_union_in_select { @@ -30,10 +31,7 @@ struct User3 { TEST(postgres, test_union_in_select) { using namespace sqlgen::literals; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto conn = sqlgen::postgres::connect(credentials) .and_then(sqlgen::drop | sqlgen::if_exists) diff --git a/tests/postgres/test_unique.cpp b/tests/postgres/test_unique.cpp index 9c0ae77..5407935 100644 --- a/tests/postgres/test_unique.cpp +++ b/tests/postgres/test_unique.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_unique { @@ -29,10 +30,7 @@ TEST(postgres, test_unique) { Person{ .id = 4, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_update.cpp b/tests/postgres/test_update.cpp index a340240..b4c835d 100644 --- a/tests/postgres/test_update.cpp +++ b/tests/postgres/test_update.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_update { @@ -28,10 +29,7 @@ TEST(postgres, test_update) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_update_with_optional.cpp b/tests/postgres/test_update_with_optional.cpp index ec1f2e7..fca2e20 100644 --- a/tests/postgres/test_update_with_optional.cpp +++ b/tests/postgres/test_update_with_optional.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_update_with_optional { @@ -28,10 +29,7 @@ TEST(postgres, test_update_with_optional) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_varchar.cpp b/tests/postgres/test_varchar.cpp index 6f1367c..da654da 100644 --- a/tests/postgres/test_varchar.cpp +++ b/tests/postgres/test_varchar.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_varchar { @@ -27,10 +28,7 @@ TEST(postgres, test_varchar) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_where.cpp b/tests/postgres/test_where.cpp index b1dbb82..c369910 100644 --- a/tests/postgres/test_where.cpp +++ b/tests/postgres/test_where.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_where { @@ -28,10 +29,7 @@ TEST(postgres, test_where) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_where_with_operations.cpp b/tests/postgres/test_where_with_operations.cpp index 188f2c9..8d6b9d1 100644 --- a/tests/postgres/test_where_with_operations.cpp +++ b/tests/postgres/test_where_with_operations.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_where_with_operations { @@ -28,10 +29,7 @@ TEST(postgres, test_where_with_operations) { Person{ .id = 4, .first_name = "Hugo", .last_name = "Simpson", .age = 10}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_where_with_timestamps.cpp b/tests/postgres/test_where_with_timestamps.cpp index b6c7d0c..f3dabbf 100644 --- a/tests/postgres/test_where_with_timestamps.cpp +++ b/tests/postgres/test_where_with_timestamps.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_where_with_timestamps { @@ -33,10 +34,7 @@ TEST(postgres, test_where_with_timestamps) { .last_name = "Simpson", .birthday = sqlgen::Date("2010-01-01")}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_write_and_read.cpp b/tests/postgres/test_write_and_read.cpp index cc96c77..631cde9 100644 --- a/tests/postgres/test_write_and_read.cpp +++ b/tests/postgres/test_write_and_read.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_write_and_read { @@ -26,10 +27,7 @@ TEST(postgres, test_write_and_read) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_write_and_read_curried.cpp b/tests/postgres/test_write_and_read_curried.cpp index de57bac..50dbbea 100644 --- a/tests/postgres/test_write_and_read_curried.cpp +++ b/tests/postgres/test_write_and_read_curried.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_write_and_read_curried { @@ -26,10 +27,7 @@ TEST(postgres, test_write_and_read_curried) { Person{ .id = 3, .first_name = "Maggie", .last_name = "Simpson", .age = 0}}); - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); using namespace sqlgen; using namespace sqlgen::literals; diff --git a/tests/postgres/test_write_and_read_pool.cpp b/tests/postgres/test_write_and_read_pool.cpp index c9e34c9..adb5fd0 100644 --- a/tests/postgres/test_write_and_read_pool.cpp +++ b/tests/postgres/test_write_and_read_pool.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "test_helpers.hpp" namespace test_write_and_read_pool { @@ -28,10 +29,7 @@ TEST(postgres, test_write_and_read_pool) { const auto pool_config = sqlgen::ConnectionPoolConfig{.size = 2}; - const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", - .password = "password", - .host = "localhost", - .dbname = "postgres"}; + const auto credentials = sqlgen::postgres::test::make_credentials(); const auto pool = sqlgen::make_connection_pool( pool_config, credentials);