Merge pull request #3895 from mapycz/postgis-connection-creator-id
postgis: Exclude password from ConnectionCreator::id()
This commit is contained in:
commit
c2fe73ecbe
2 changed files with 19 additions and 1 deletions
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
inline std::string id() const
|
||||
{
|
||||
return connection_string();
|
||||
return connection_string_safe();
|
||||
}
|
||||
|
||||
inline std::string connection_string() const
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <mapnik/geometry/geometry_type.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include "../../../plugins/input/postgis/connection_manager.hpp"
|
||||
|
||||
/*
|
||||
Compile and run just this test:
|
||||
|
@ -406,3 +407,20 @@ TEST_CASE("postgis") {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("ConnectionCreator") {
|
||||
|
||||
SECTION("ConnectionCreator::id() should not expose password")
|
||||
{
|
||||
ConnectionCreator<Connection> creator(boost::optional<std::string>("host"),
|
||||
boost::optional<std::string>("12345"),
|
||||
boost::optional<std::string>("dbname"),
|
||||
boost::optional<std::string>("user"),
|
||||
boost::optional<std::string>("pass"),
|
||||
boost::optional<std::string>("111"));
|
||||
|
||||
CHECK(creator.id() == "host=host port=12345 dbname=dbname user=user connect_timeout=111");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue