File: object_storage_endpoint_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 (30 lines) | stat: -rw-r--r-- 794 bytes parent folder | download
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
package unit

import (
	"context"
	"testing"

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

func TestObjectStorageEndpoint_List(t *testing.T) {
	fixtureData, err := fixtures.GetFixture("object_storage_endpoints_list")
	assert.NoError(t, err)

	var base ClientBaseCase
	base.SetUp(t)
	defer base.TearDown(t)

	base.MockGet("object-storage/endpoints", fixtureData)

	endpoints, err := base.Client.ListObjectStorageEndpoints(context.Background(), nil)
	if err != nil {
		t.Fatalf("Error getting endpoints: %v", err)
	}

	assert.Equal(t, 2, len(endpoints))
	assert.Equal(t, "us-east-1", endpoints[0].Region)
	assert.Equal(t, "https://s3.us-east-1.linodeobjects.com", *endpoints[0].S3Endpoint)
	assert.Equal(t, linodego.ObjectStorageEndpointE0, endpoints[0].EndpointType)
}