Conditions | 1 |
Total Lines | 28 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package smobilpay |
||
13 | func TestTopupService_GetPackages(t *testing.T) { |
||
14 | // Setup |
||
15 | t.Parallel() |
||
16 | |||
17 | // Arrange |
||
18 | server := helpers.MakeTestServer(http.StatusOK, stubs.TopupGetPackagesOk()) |
||
19 | accessToken := "6B352110-4716-11ED-963F-0800200C9A66" |
||
20 | client := New( |
||
21 | WithBaseURL(server.URL), |
||
22 | WithAccessToken(accessToken), |
||
23 | WithAccessSecret("1B875FB0-4717-11ED-963F-0800200C9A66"), |
||
24 | ) |
||
25 | nonce := "95cdf110-4614-4d95-b6c2-f14fe01c4995" |
||
26 | |||
27 | // Act |
||
28 | topupPackages, response, err := client.Topup.GetPackages( |
||
29 | context.Background(), |
||
30 | "1234", |
||
31 | WithRequestNonce(nonce), |
||
32 | ) |
||
33 | |||
34 | // Assert |
||
35 | assert.Nil(t, err) |
||
36 | assert.Equal(t, http.StatusOK, response.HTTPResponse.StatusCode) |
||
37 | assert.Equal(t, 2, len(topupPackages)) |
||
38 | |||
39 | // Teardown |
||
40 | server.Close() |
||
41 | } |
||
42 |