Skip to content

Commit

Permalink
Unit test for url parser changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JD-Robertson committed Sep 19, 2023
1 parent 4b6651b commit 6c18522
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/mongo/url_parser_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,24 @@ defmodule Mongo.UrlParserTest do
username = Keyword.get(opts, :username)
assert username == real_username
end

test "external auth source " do
encoded_external_auth_source = URI.encode_www_form("$external")
url = "mongodb://user:[email protected]:27017,seed2.domain.com:27017,seed3.domain.com:27017/db_name?replicaSet=set-name&authMechanism=PLAIN&authSource=#{encoded_external_auth_source}&tls=true"
assert UrlParser.parse_url(url: url) |> Keyword.drop([:pw_safe]) == [
password: "*****",
username: "user",
database: "db_name",
tls: true,
auth_source: "$external",
auth_mechanism: :plain,
set_name: "set-name",
seeds: [
"seed1.domain.com:27017",
"seed2.domain.com:27017",
"seed3.domain.com:27017"
]
]
end
end
end

0 comments on commit 6c18522

Please sign in to comment.