-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathaccess_token_test.go
More file actions
53 lines (48 loc) · 1.32 KB
/
access_token_test.go
File metadata and controls
53 lines (48 loc) · 1.32 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
52
53
package localxpose
import (
"testing"
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/plugintest"
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
)
func TestAccessTokenProvisioner(t *testing.T) {
plugintest.TestProvisioner(t, AccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{
"default": {
ItemFields: map[sdk.FieldName]string{
fieldname.AccessToken: "PROVISIONERqLtcqQ8a3oRVfK5tiHzDOhEXAMPLE",
},
ExpectedOutput: sdk.ProvisionOutput{
Environment: map[string]string{
"LX_ACCESS_TOKEN": "PROVISIONERqLtcqQ8a3oRVfK5tiHzDOhEXAMPLE",
},
},
},
})
}
func TestAccessTokenImporter(t *testing.T) {
expectedFields := map[sdk.FieldName]string{
fieldname.AccessToken: "31QJpgl8FB9qLtcqQ8a3oRVfK5tiHzDOhEXAMPLE",
}
plugintest.TestImporter(t, AccessToken().Importer, map[string]plugintest.ImportCase{
"environment": {
Environment: map[string]string{
"LX_ACCESS_TOKEN": "31QJpgl8FB9qLtcqQ8a3oRVfK5tiHzDOhEXAMPLE",
},
ExpectedCandidates: []sdk.ImportCandidate{
{
Fields: expectedFields,
},
},
},
"file": {
Files: map[string]string{
"~/.localxpose/.access": plugintest.LoadFixture(t, "localxpose.access"),
},
ExpectedCandidates: []sdk.ImportCandidate{
{
Fields: expectedFields,
},
},
},
})
}