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