File: network_transfer_prices_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 (40 lines) | stat: -rw-r--r-- 976 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
package integration

import (
	"context"
	"testing"

	"github.com/linode/linodego"
	"github.com/stretchr/testify/require"
)

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

	prices, err := client.ListNetworkTransferPrices(context.Background(), nil)
	require.NoError(t, err)
	require.Greater(t, len(prices), 0)

	for _, price := range prices {
		validateNetworkTransferPrice(t, price)
	}
}

func validateNetworkTransferPrice(
	t *testing.T,
	price linodego.NetworkTransferPrice,
) {
	require.NotEmpty(t, price.ID)
	require.NotEmpty(t, price.Label)

	// NOTE: We do not check for monthly prices here because it is
	// explicitly set to null.
	require.Greater(t, price.Price.Hourly, 0.0)
	require.GreaterOrEqual(t, price.Transfer, 0)

	for _, regionPrice := range price.RegionPrices {
		require.NotEmpty(t, regionPrice.ID)
		require.Greater(t, regionPrice.Hourly, 0.0)
	}
}