File: account_availability_test.go

package info (click to toggle)
golang-github-linode-linodego 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,112 kB
  • sloc: makefile: 96; sh: 52; python: 24
file content (37 lines) | stat: -rw-r--r-- 1,035 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
27
28
29
30
31
32
33
34
35
36
37
package integration

import (
	"context"
	"testing"

	"github.com/linode/linodego"
)

func TestAccountAvailability_List(t *testing.T) {
	client, teardown := createTestClient(t, "fixtures/TestAccountAvailability_List")
	defer teardown()

	availabilities, err := client.ListAccountAvailabilities(context.Background(), &linodego.ListOptions{})
	if err != nil {
		t.Errorf("Error getting Account Availabilities, expected struct, got error %v", err)
	}

	if len(availabilities) == 0 {
		t.Errorf("Expected to see account availabilities returned.")
	}
}

func TestAccountAvailability_Get(t *testing.T) {
	client, teardown := createTestClient(t, "fixtures/TestAccountAvailability_Get")
	defer teardown()

	regionID := "us-east"
	availability, err := client.GetAccountAvailability(context.Background(), regionID)
	if err != nil {
		t.Errorf("Error getting Account Availability, expected struct, got error %v", err)
	}

	if availability.Region != regionID {
		t.Errorf("expected region ID to be %s; got %s", regionID, availability.Region)
	}
}