GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch feature/payments-resource-impl... (bdb051)
by Victor Hugo
02:14
created

mollie/payments_test.go   A

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 10
eloc 39
dl 0
loc 57
rs 10
c 0
b 0
f 0
1
package mollie
2
3
import (
4
	"context"
5
	"fmt"
6
	"net/http"
7
	"reflect"
8
	"testing"
9
10
	"github.com/VictorAvelar/mollie-api-go/mollie/testdata"
11
)
12
13
func TestPaymentsList(t *testing.T) {
14
	setup()
15
	defer teardown()
16
	paymentsAPIEndpoint := "/v2/payments"
17
18
	testMux.HandleFunc(paymentsAPIEndpoint, func(w http.ResponseWriter, r *http.Request) {
19
		_, ok := r.Header[AuthHeader]
20
		if !ok {
21
			w.WriteHeader(http.StatusUnauthorized)
22
		}
23
		raw := testdata.ListPaymentsExample
24
		fmt.Fprint(w, raw)
25
	})
26
27
	err := testClient.WithAPIKey("dummy-key")
28
	if err != nil {
29
		t.Fatal(err)
30
	}
31
32
	var ctx context.Context
33
34
	tests := []struct {
35
		name    string
36
		want    int
37
		wantErr bool
38
		err     error
39
	}{
40
		{
41
			name:    "test request is successful",
42
			wantErr: false,
43
			err:     nil,
44
		},
45
	}
46
47
	for _, tt := range tests {
48
		t.Run(tt.name, func(t *testing.T) {
49
			_, err := testClient.Payments.List(ctx)
50
			if tt.wantErr && err != nil {
51
				if !reflect.DeepEqual(err, tt.err) {
52
					t.Fatal(err)
53
				}
54
			}
55
56
			if err != tt.err {
57
				t.Errorf("wanted nil, got %+v", err)
58
			}
59
		})
60
	}
61
}
62