From 70d606e2ec9a5994b169e8555c0b8dca940e9fb5 Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Mon, 18 Sep 2023 15:58:03 +0200 Subject: [PATCH] Add unit test --- tests/src/core/testqgsdatasourceuri.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/src/core/testqgsdatasourceuri.cpp b/tests/src/core/testqgsdatasourceuri.cpp index 1ce49617da65..acc57ab3fb26 100644 --- a/tests/src/core/testqgsdatasourceuri.cpp +++ b/tests/src/core/testqgsdatasourceuri.cpp @@ -35,6 +35,7 @@ class TestQgsDataSourceUri: public QObject void checkConnectionInfo_data(); void checkAuthParams(); void checkParameterKeys(); + void checkRemovePassword(); }; void TestQgsDataSourceUri::checkparser_data() @@ -524,5 +525,11 @@ void TestQgsDataSourceUri::checkParameterKeys() QVERIFY( uri.parameterKeys().contains( QLatin1String( "bar" ) ) ); } +void TestQgsDataSourceUri::checkRemovePassword() +{ + const QString uri = QgsDataSourceUri::removePassword( QStringLiteral( "postgresql://user:password@127.0.0.1:5432?dbname=test" ) ); + QCOMPARE( uri, QStringLiteral( "postgresql://user@127.0.0.1:5432?dbname=test") ); +} + QGSTEST_MAIN( TestQgsDataSourceUri ) #include "testqgsdatasourceuri.moc"