File: monitor_services_token_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-- 724 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 TestCreateMonitorServicesToken(t *testing.T) {
	// Load the mock fixture for monitor services
	fixtureData, err := fixtures.GetFixture("monitor_service_token_create")
	assert.NoError(t, err)

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

	base.MockPost("monitor/services/dbaas/token", fixtureData)

	// Create request data for POST request
	opts := linodego.MonitorTokenCreateOptions{
		EntityIDs: []any{12345, "us-54321"},
	}

	token, err := base.Client.CreateMonitorServiceTokenForServiceType(context.Background(), "dbaas", opts)
	assert.NoError(t, err)
	assert.NotNil(t, token)
}