File: facilities_test.go

package info (click to toggle)
golang-github-packethost-packngo 0.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 440 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (2)
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
package packngo

import (
	"fmt"
	"testing"
)

func TestAccFacilities(t *testing.T) {
	skipUnlessAcceptanceTestsAllowed(t)

	c := setup(t)

	l, _, err := c.Facilities.List(&ListOptions{Includes: []string{"address"}})
	if err != nil {
		t.Fatal(err)
	}
	if len(l) == 0 {
		t.Fatal(fmt.Errorf("Expected to get non-zero facilities"))

	}
	for _, f := range l {
		if f.Code == "" {
			t.Fatal(fmt.Errorf("facility %+v has empty Code (slug) attr", f))
		}
	}
}