/usr/share/gocode/src/github.com/go-chef/chef/principal_test.go is in golang-github-go-chef-chef-dev 0.0.1+git20161023.60.deb8c38-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | package chef
import (
"fmt"
"net/http"
_ "reflect"
"testing"
)
func TestPrincipalsGet(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/principals/client_node", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `{
"name": "client_node",
"type": "client",
"public_key": "-----BEGIN PUBLIC KEY-----No, not really-----END PUBLIC KEY-----"
}`)
})
p, err := client.Principals.Get("client_node")
if err != nil {
t.Errorf("GET principal error making request: ", err)
return
}
if p.Name != "client_node" {
t.Errorf("Unexpected principal name: ", p.Name)
}
if p.Type != "client" {
t.Errorf("Unexpected principal type: ", p.Type)
}
if p.PublicKey != "-----BEGIN PUBLIC KEY-----No, not really-----END PUBLIC KEY-----" {
t.Errorf("Unexpected principal public key: ", p.PublicKey)
}
}
|