{
	"tests": [
		{
			"description": "should use the default source and mechanism",
			"uri": "mongodb://user:password@localhost",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "admin"
			},
			"options": null
		},
		{
			"description": "should use the database when no authSource is specified",
			"uri": "mongodb://user:password@localhost/foo",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "foo"
			},
			"options": null
		},
		{
			"description": "should use the authSource when specified",
			"uri": "mongodb://user:password@localhost/foo?authSource=bar",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "bar"
			},
			"options": null
		},
		{
			"description": "should recognize an empty password",
			"uri": "mongodb://user:@localhost",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"username": "user",
				"password": ""
			},
			"options": null
		},
		{
			"description": "should recognize no password",
			"uri": "mongodb://user@localhost",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"username": "user",
				"password": null
			},
			"options": null
		},
		{
			"description": "should recognize no password",
			"uri": "mongodb://user@localhost",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"username": "user",
				"password": null
			},
			"options": null
		},
		{
			"description": "should recognize a url escaped character in the username",
			"uri": "mongodb://user%40DOMAIN.COM:password@localhost",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"username": "user@DOMAIN.COM"
			},
			"options": null
		},
		{
			"description": "should recognize the mechanism",
			"uri": "mongodb://user@localhost/?authMechanism=GSSAPI",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "GSSAPI"
			}
		},
		{
			"description": "should use $external as the source",
			"uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "$external"
			},
			"options": null
		},
		{
			"description": "should use $external as the source when a database is specified",
			"uri": "mongodb://user%40DOMAIN.COM:password@localhost/foo?authMechanism=GSSAPI",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "$external"
			},
			"options": null
		},
		{
			"description": "should throw an exception when an authSource is specified other than $external",
			"uri": "mongodb://user%40DOMAIN.COM:password@localhost/foo?authMechanism=GSSAPI&authSource=bar",
			"hosts": [],
			"valid": false,
			"warning": true,
			"auth": null,
			"options": null

		},
		{
			"description": "should throw an exception when an authMechanism is specified with no username",
			"uri": "mongodb://localhost/?authMechanism=GSSAPI",
			"hosts": [],
			"valid": false,
			"warning": true,
			"auth": null,
			"options": null
		},
		{
			"description": "should accept generic mechanism property",
			"uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "GSSAPI",
				"authmechanismproperties": {
					"SERVICE_NAME": "other",
					"CANONICALIZE_HOST_NAME": true
				}
			}
		},
		{
			"description": "should accept legacy gssapiServiceName",
			"uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&gssapiServiceName=other",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "GSSAPI",
				"authmechanismproperties": {
					"SERVICE_NAME": "other"
				}
			}
		},
		{
			"description": "should recognize the mechanism",
			"uri": "mongodb://user:pass@localhost/?authMechanism=MONGODB-CR",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "MONGODB-CR"
			}
		},
		{
			"description": "should throw an exception when an authMechanism is specified with no username",
			"uri": "mongodb://localhost/?authMechanism=MONGODB-CR",
			"hosts": [],
			"valid": false,
			"warning": true,
			"auth": null,
			"options": null
		},
		{
			"description": "should use $external as the source",
			"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "$external"
			},
			"options": null
		},
		{
			"description": "should use $external as the source when a database is specified",
			"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"db": "$external"
			},
			"options": null
		},
		{
			"description": "should throw an exception when an authSource is specified other than $external",
			"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509&authSource=bar",
			"hosts": [],
			"valid": false,
			"warning": true,
			"auth": null,
			"options": null
		},
		{
			"description": "should recognize the mechanism",
			"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "MONGODB-X509"
			}
		},
		{
			"description": "should recognize the mechanism with no username",
			"uri": "mongodb://localhost/?authMechanism=MONGODB-X509",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"username": null
			},
			"options": {
				"authmechanism": "MONGODB-X509"
			}
		},
		{
			"description": "should recognize the encoded username",
			"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": {
				"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry"
			},
			"options": null
		},
		{
			"description": "should recognize the mechanism",
			"uri": "mongodb://user:password@localhost/?authMechanism=PLAIN",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "PLAIN"
			}
		},
		{
			"description": "should throw an exception when an authMechanism is specified with no username",
			"uri": "mongodb://localhost/?authMechanism=PLAIN",
			"hosts": [],
			"valid": false,
			"warning": true,
			"auth": null,
			"options": null
		},
		{
			"description": "should recognize the mechanism",
			"uri": "mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-1",
			"hosts": [],
			"valid": true,
			"warning": false,
			"auth": null,
			"options": {
				"authmechanism": "SCRAM-SHA-1"
			}
		},
		{
			"description": "should throw an exception when an authMechanism is specified with no username",
			"uri": "mongodb://localhost/?authMechanism=SCRAM-SHA-1",
			"hosts": [],
			"valid": false,
			"warning": true,
			"auth": null,
			"options": null
		}
	]
}
