forked from getconversio/go-shopify
-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathaccess_scopes_test.go
More file actions
51 lines (42 loc) · 1.06 KB
/
access_scopes_test.go
File metadata and controls
51 lines (42 loc) · 1.06 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package goshopify
import (
"context"
"reflect"
"testing"
"github.com/jarcoal/httpmock"
)
func TestAccessScopesServiceOp_List(t *testing.T) {
setup()
defer teardown()
httpmock.RegisterResponder(
"GET",
"https://fooshop.myshopify.com/admin/oauth/access_scopes.json",
httpmock.NewBytesResponder(200, loadFixture("access_scopes.json")),
)
scopeResponse, err := client.AccessScopes.List(context.Background(), nil)
if err != nil {
t.Errorf("AccessScopes.List returned an error: %v", err)
}
expected := []AccessScope{
{
Handle: "scope_1",
},
{
Handle: "scope_2",
},
}
if !reflect.DeepEqual(scopeResponse, expected) {
t.Errorf("AccessScopes.List returned %+v, expected %+v", expected, expected)
}
}
func TestAccessScopesServiceOp_ListError(t *testing.T) {
setup()
defer teardown()
scopeResponse, err := client.AccessScopes.List(context.Background(), 123)
if scopeResponse != nil {
t.Errorf("AccessScopes.List returned scopes, expected nil: %v", scopeResponse)
}
if err == nil {
t.Errorf("AccessScopes.List err = nil, expected error")
}
}