joao/internal/testing/fixtures.go

213 lines
5.2 KiB
Go
Raw Normal View History

package fixtures
import (
"github.com/1Password/connect-sdk-go/onepassword"
"github.com/sirupsen/logrus"
)
func EnableDebugLogging() {
logrus.SetLevel(logrus.DebugLevel)
}
func NewTestConfig(title string) *onepassword.Item {
return &onepassword.Item{
Title: title,
Vault: onepassword.ItemVault{ID: "example"},
Category: "PASSWORD",
Sections: []*onepassword.ItemSection{
{ID: "~annotations", Label: "~annotations"},
{ID: "nested", Label: "nested"},
{ID: "list", Label: "list"},
},
Fields: []*onepassword.ItemField{
{
ID: "password",
Type: "CONCEALED",
Purpose: "PASSWORD",
Label: "password",
Value: "8b23de7705b79b73d9f75b120651bc162859e45a732b764362feaefc882eab5d",
},
{
ID: "notesPlain",
Type: "STRING",
Purpose: "NOTES",
Label: "notesPlain",
Value: "flushed by joao",
},
{
ID: "~annotations.int",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "int",
Value: "int",
},
{
ID: "int",
Type: "STRING",
Label: "int",
Value: "1",
},
{
ID: "string",
Type: "STRING",
Label: "string",
Value: "pato",
},
{
ID: "~annotations.bool",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "bool",
Value: "bool",
},
{
ID: "bool",
Type: "STRING",
Label: "bool",
Value: "false",
},
{
ID: "~annotations.secret",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "secret",
Value: "secret",
},
{
ID: "secret",
Type: "CONCEALED",
Label: "secret",
Value: "very secret",
},
{
ID: "~annotations.nested.int",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.int",
Value: "int",
},
{
ID: "nested.int",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "STRING",
Label: "int",
Value: "1",
},
{
ID: "~annotations.nested.bool",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.bool",
Value: "bool",
},
{
ID: "nested.bool",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "STRING",
Label: "bool",
Value: "true",
},
{
ID: "~annotations.nested.list.0",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.list.0",
Value: "int",
},
{
ID: "nested.list.0",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "STRING",
Label: "list.0",
Value: "1",
},
{
ID: "~annotations.nested.list.1",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.list.1",
Value: "int",
},
{
ID: "nested.list.1",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "STRING",
Label: "list.1",
Value: "2",
},
{
ID: "~annotations.nested.list.2",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.list.2",
Value: "int",
},
{
ID: "nested.list.2",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "STRING",
Label: "list.2",
Value: "3",
},
{
ID: "~annotations.nested.secret",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.secret",
Value: "secret",
},
{
ID: "nested.secret",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "CONCEALED",
Label: "secret",
Value: "very secret",
},
{
ID: "~annotations.nested.second_secret",
Section: &onepassword.ItemSection{ID: "~annotations", Label: "~annotations"},
Type: "STRING",
Label: "nested.second_secret",
Value: "secret",
},
{
ID: "nested.second_secret",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "CONCEALED",
Label: "second_secret",
Value: "very secret",
},
{
ID: "nested.string",
Section: &onepassword.ItemSection{ID: "nested", Label: "nested"},
Type: "STRING",
Label: "string",
Value: "quem",
},
{
ID: "list.0",
Section: &onepassword.ItemSection{ID: "list", Label: "list"},
Type: "STRING",
Label: "0",
Value: "one",
},
{
ID: "list.1",
Section: &onepassword.ItemSection{ID: "list", Label: "list"},
Type: "STRING",
Label: "1",
Value: "two",
},
{
ID: "list.2",
Section: &onepassword.ItemSection{ID: "list", Label: "list"},
Type: "STRING",
Label: "2",
Value: "three",
},
},
}
}
var TestConfig = NewTestConfig("some:test")