File: betas_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 (46 lines) | stat: -rw-r--r-- 1,237 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
38
39
40
41
42
43
44
45
46
package integration

import (
	"context"
	"testing"

	"github.com/linode/linodego"
)

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

	betas, err := client.ListBetaPrograms(context.Background(), &linodego.ListOptions{})
	if err != nil {
		t.Errorf("Error getting Beta programs, expected struct, got error %v", err)
	}

	if len(betas) == 0 {
		t.Errorf("Expected to see beta program returned.")
	} else {
		assertDateSet(t, betas[0].Started)
	}
}

func TestBetaProgram_Get(t *testing.T) {
	client, teardown := createTestClient(t, "fixtures/TestBetaProgram_Get")
	defer teardown()
	betaPrograms, err := client.ListBetaPrograms(context.Background(), linodego.NewListOptions(0, ""))
	if err != nil {
		t.Fatalf("error listing Beta program, %v", err)
	}
	if len(betaPrograms) == 0 {
		t.Skip("no beta program is available, skipping getting beta program test.")
	}

	betaID := betaPrograms[0].ID
	beta, err := client.GetBetaProgram(context.Background(), betaID)
	if err != nil {
		t.Errorf("Error getting Beta program, expected struct, got error %v", err)
	}

	if beta.ID != betaID {
		t.Errorf("expected beta ID to be %s; got %s", betaID, beta.ID)
	}
}