From 6dd53a5bdab1521dbc5c5956c3f0bcce7c499d4a Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 23 Jan 2014 11:12:28 -0800 Subject: [PATCH] Adding credentials test --- credentials_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 credentials_test.go diff --git a/credentials_test.go b/credentials_test.go new file mode 100644 index 0000000..e14256b --- /dev/null +++ b/credentials_test.go @@ -0,0 +1,24 @@ +package socks5 + +import ( + "testing" +) + +func TestStaticCredentials(t *testing.T) { + creds := StaticCredentials{ + "foo": "bar", + "baz": "", + } + + if !creds.Valid("foo", "bar") { + t.Fatalf("expect valid") + } + + if !creds.Valid("baz", "") { + t.Fatalf("expect valid") + } + + if creds.Valid("foo", "") { + t.Fatalf("expect invalid") + } +}