neero.TestPaymentMethodService_Create   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nop 1
dl 0
loc 23
rs 9.75
c 0
b 0
f 0
1
package neero
2
3
import (
4
	"context"
5
	"net/http"
6
	"testing"
7
8
	"github.com/NdoleStudio/neero-go/internal"
9
	"github.com/stretchr/testify/assert"
10
)
11
12
func TestPaymentMethodService_Create(t *testing.T) {
13
	// Setup
14
	t.Parallel()
15
16
	// Arrange
17
	server := internal.MakeTestServer(http.StatusOK, internal.CreatePaymentMethodResponse())
18
	client := New(WithBaseURL(server.URL))
19
	request := &CreatePaymentMethodRequestMobileMoneyDetails{
20
		PhoneNumber:         "+237678877898",
21
		CountryIso:          "CM",
22
		MobileMoneyProvider: MobileMoneyProviderMTNMoney,
23
	}
24
25
	// Act
26
	paymentMethod, response, err := client.PaymentMethod.Create(context.Background(), request)
27
28
	// Assert
29
	assert.Nil(t, err)
30
	assert.Equal(t, http.StatusOK, response.HTTPResponse.StatusCode)
31
	assert.Equal(t, "68ceed244e5f2f5a69f72657", paymentMethod.ID)
32
33
	// Teardown
34
	server.Close()
35
}
36