tests: - description: "User info for single IPv4 host without database" uri: "mongodb://alice:foo@127.0.0.1" valid: true warning: false hosts: - type: "ipv4" host: "127.0.0.1" port: ~ auth: username: "alice" password: "foo" db: ~ options: ~ - description: "User info for single IPv4 host with database" uri: "mongodb://alice:foo@127.0.0.1/test" valid: true warning: false hosts: - type: "ipv4" host: "127.0.0.1" port: ~ auth: username: "alice" password: "foo" db: "test" options: ~ - description: "User info for single IP literal host without database" uri: "mongodb://bob:bar@[::1]:27018" valid: true warning: false hosts: - type: "ip_literal" host: "::1" port: 27018 auth: username: "bob" password: "bar" db: ~ options: ~ - description: "User info for single IP literal host with database" uri: "mongodb://bob:bar@[::1]:27018/admin" valid: true warning: false hosts: - type: "ip_literal" host: "::1" port: 27018 auth: username: "bob" password: "bar" db: "admin" options: ~ - description: "User info for single hostname without database" uri: "mongodb://eve:baz@example.com" valid: true warning: false hosts: - type: "hostname" host: "example.com" port: ~ auth: username: "eve" password: "baz" db: ~ options: ~ - description: "User info for single hostname with database" uri: "mongodb://eve:baz@example.com/db2" valid: true warning: false hosts: - type: "hostname" host: "example.com" port: ~ auth: username: "eve" password: "baz" db: "db2" options: ~ - description: "User info for multiple hosts without database" uri: "mongodb://alice:secret@127.0.0.1,example.com:27018" valid: true warning: false hosts: - type: "ipv4" host: "127.0.0.1" port: ~ - type: "hostname" host: "example.com" port: 27018 auth: username: "alice" password: "secret" db: ~ options: ~ - description: "User info for multiple hosts with database" uri: "mongodb://alice:secret@example.com,[::1]:27019/admin" valid: true warning: false hosts: - type: "hostname" host: "example.com" port: ~ - type: "ip_literal" host: "::1" port: 27019 auth: username: "alice" password: "secret" db: "admin" options: ~ - description: "Username without password" uri: "mongodb://alice@127.0.0.1" valid: true warning: false hosts: - type: "ipv4" host: "127.0.0.1" port: ~ auth: username: "alice" password: ~ db: ~ options: ~ - description: "Username with empty password" uri: "mongodb://alice:@127.0.0.1" valid: true warning: false hosts: - type: "ipv4" host: "127.0.0.1" port: ~ auth: username: "alice" password: "" db: ~ options: ~ - description: "Escaped username and database without password" uri: "mongodb://%40l%3Ace%2F%3D@example.com/my%3Ddb" valid: true warning: false hosts: - type: "hostname" host: "example.com" port: ~ auth: username: "@l:ce/=" password: ~ db: "my=db" options: ~ - description: "Escaped user info and database (MONGODB-CR)" uri: "mongodb://%24am:f%3Azzb%40z%2Fz%3D@127.0.0.1/admin%3F?authMechanism=MONGODB-CR" valid: true warning: false hosts: - type: "ipv4" host: "127.0.0.1" port: ~ auth: username: "$am" password: "f:zzb@z/z=" db: "admin?" options: authmechanism: "MONGODB-CR" - description: "Escaped username (MONGODB-X509)" uri: "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509" valid: true warning: false hosts: - type: "hostname" host: "localhost" port: ~ auth: username: "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry" password: ~ db: ~ options: authmechanism: "MONGODB-X509" - description: "Escaped username (GSSAPI)" uri: "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authMechanism=GSSAPI" valid: true warning: false hosts: - type: "hostname" host: "localhost" port: ~ auth: username: "user@EXAMPLE.COM" password: "secret" db: ~ options: authmechanism: "GSSAPI" authmechanismproperties: SERVICE_NAME: "other" CANONICALIZE_HOST_NAME: true - description: "At-signs in options aren't part of the userinfo" uri: "mongodb://alice:secret@example.com/admin?replicaset=my@replicaset" valid: true warning: false hosts: - type: "hostname" host: "example.com" port: ~ auth: username: "alice" password: "secret" db: "admin" options: replicaset: "my@replicaset"