File: account_payments_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 (34 lines) | stat: -rw-r--r-- 717 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
package unit

import (
	"context"
	"encoding/json"
	"testing"

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

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

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

	base.MockPost("account/payments", fixtureData)

	requestData := linodego.PaymentCreateOptions{
		CVV: "123",
		USD: json.Number("120.50"),
	}

	payment, err := base.Client.CreatePayment(context.Background(), requestData)
	if err != nil {
		t.Fatalf("Error creating payment: %v", err)
	}

	assert.Equal(t, 123, payment.ID)
	assert.Equal(t, json.Number("120.50"), payment.USD)
}