19 lines
723 B
Go
19 lines
723 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
// A message that says where the proxy could not connect never carries the account's password.
|
|
func TestABusAddressIsSaidWithoutItsCredential(t *testing.T) {
|
|
for in, want := range map[string]string{
|
|
"nats://route-proxy:secret@127.0.0.1:4222": "nats://127.0.0.1:4222",
|
|
"route-proxy:secret@127.0.0.1:4222": "127.0.0.1:4222",
|
|
"nats://u:a@b@127.0.0.1:4222": "nats://127.0.0.1:4222", // the password holds an at-sign
|
|
"nats://127.0.0.1:4222": "nats://127.0.0.1:4222",
|
|
"127.0.0.1:4222": "127.0.0.1:4222",
|
|
} {
|
|
if got := bareAddress(in); got != want {
|
|
t.Errorf("bareAddress(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
}
|