Basic support for passing postgresql uri on the commandline
This commit is contained in:
parent
4b4c95e57e
commit
4caccf1000
11 changed files with 453 additions and 192 deletions
|
|
@ -19,6 +19,7 @@ SOURCES += main.cpp \
|
|||
tst_ConvertToMultiLineCString.cpp \
|
||||
tst_ExplainJsonParser.cpp \
|
||||
tst_HumanReadableBytes.cpp \
|
||||
tst_TryParsePostgresqlUrl.cpp \
|
||||
tst_escapeConnectionStringValue.cpp \
|
||||
tst_expected.cpp \
|
||||
tst_SqlLexer.cpp \
|
||||
|
|
|
|||
20
tests/pglabtests/tst_TryParsePostgresqlUrl.cpp
Normal file
20
tests/pglabtests/tst_TryParsePostgresqlUrl.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include <ConnectionConfig.h>
|
||||
#include "utils/PostgresqlUrlParser.h"
|
||||
#include "PrintTo_Qt.h"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
TEST(TryParsePostgresqlUrl, emptyInput)
|
||||
{
|
||||
QString urlString = "postgresql://user:secret@localhost:5433/otherdb?connect_timeout=10&application_name=myapp";
|
||||
ConnectionConfig config;
|
||||
bool result = TryParsePostgresqlUrl(urlString, config);
|
||||
ASSERT_TRUE(result);
|
||||
ASSERT_THAT(config.user(), Eq("user"));
|
||||
ASSERT_THAT(config.password(), Eq("secret"));
|
||||
ASSERT_THAT(config.host(), Eq("localhost"));
|
||||
ASSERT_THAT(config.dbname(), Eq("otherdb"));
|
||||
ASSERT_THAT(config.port(), Eq(5433));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue