/usr/share/gocode/src/github.com/digitalocean/godo/account_test.go is in golang-github-digitalocean-godo-dev 1.1.0-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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | package godo
import (
"fmt"
"net/http"
"reflect"
"testing"
)
func TestAccountGet(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/v2/account", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
response := `
{ "account": {
"droplet_limit": 25,
"floating_ip_limit": 25,
"email": "sammy@digitalocean.com",
"uuid": "b6fr89dbf6d9156cace5f3c78dc9851d957381ef",
"email_verified": true
}
}`
fmt.Fprint(w, response)
})
acct, _, err := client.Account.Get(ctx)
if err != nil {
t.Errorf("Account.Get returned error: %v", err)
}
expected := &Account{DropletLimit: 25, FloatingIPLimit: 25, Email: "sammy@digitalocean.com",
UUID: "b6fr89dbf6d9156cace5f3c78dc9851d957381ef", EmailVerified: true}
if !reflect.DeepEqual(acct, expected) {
t.Errorf("Account.Get returned %+v, expected %+v", acct, expected)
}
}
func TestAccountString(t *testing.T) {
acct := &Account{
DropletLimit: 25,
FloatingIPLimit: 25,
Email: "sammy@digitalocean.com",
UUID: "b6fr89dbf6d9156cace5f3c78dc9851d957381ef",
EmailVerified: true,
Status: "active",
StatusMessage: "message",
}
stringified := acct.String()
expected := `godo.Account{DropletLimit:25, FloatingIPLimit:25, Email:"sammy@digitalocean.com", UUID:"b6fr89dbf6d9156cace5f3c78dc9851d957381ef", EmailVerified:true, Status:"active", StatusMessage:"message"}`
if expected != stringified {
t.Errorf("Account.String returned %+v, expected %+v", stringified, expected)
}
}
|