credentials_test.go 332 B

123456789101112131415161718192021222324
  1. package socks5
  2. import (
  3. "testing"
  4. )
  5. func TestStaticCredentials(t *testing.T) {
  6. creds := StaticCredentials{
  7. "foo": "bar",
  8. "baz": "",
  9. }
  10. if !creds.Valid("foo", "bar") {
  11. t.Fatalf("expect valid")
  12. }
  13. if !creds.Valid("baz", "") {
  14. t.Fatalf("expect valid")
  15. }
  16. if creds.Valid("foo", "") {
  17. t.Fatalf("expect invalid")
  18. }
  19. }