go-hep.org/x/hep@v0.38.1/xrootd/xrdproto/auth/host/host_test.go (about) 1 // Copyright ©2018 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package host_test 6 7 import ( 8 "testing" 9 10 "go-hep.org/x/hep/xrootd/xrdproto/auth" 11 "go-hep.org/x/hep/xrootd/xrdproto/auth/host" 12 ) 13 14 func TestAuthHost(t *testing.T) { 15 hauth := host.Auth{Hostname: "example.org"} 16 if got, want := hauth.Provider(), "host"; got != want { 17 t.Fatalf("invalid auth type: got=%q, want=%q", got, want) 18 } 19 20 req, err := hauth.Request(nil) 21 if err != nil { 22 t.Fatalf("got err=%v", err) 23 } 24 25 want := &auth.Request{Type: host.Type, Credentials: "host\000example.org\000"} 26 if *want != *req { 27 t.Fatalf("invalid request:\ngot= %#v\nwant=%#v", req, want) 28 } 29 }