@@ -56,7 +56,9 @@ func Test_rootCommand(t *testing.T) {
5656 require .NoError (t , err )
5757 impl , ok := s .(* pass.PassValue )
5858 require .True (t , ok )
59- assert .Equal (t , "bar=bar=bar" , string (impl .Value ))
59+ v , err := impl .Marshal ()
60+ require .NoError (t , err )
61+ assert .Equal (t , "bar=bar=bar" , string (v ))
6062 })
6163 t .Run ("from STDIN" , func (t * testing.T ) {
6264 mock := teststore .NewMockStore ()
@@ -67,7 +69,9 @@ func Test_rootCommand(t *testing.T) {
6769 require .NoError (t , err )
6870 impl , ok := s .(* pass.PassValue )
6971 require .True (t , ok )
70- assert .Equal (t , "my\n multiline\n value" , string (impl .Value ))
72+ v , err := impl .Marshal ()
73+ require .NoError (t , err )
74+ assert .Equal (t , "my\n multiline\n value" , string (v ))
7175 })
7276 t .Run ("with --metadata flag" , func (t * testing.T ) {
7377 mock := teststore .NewMockStore ()
@@ -78,7 +82,9 @@ func Test_rootCommand(t *testing.T) {
7882 require .NoError (t , err )
7983 impl , ok := s .(* pass.PassValue )
8084 require .True (t , ok )
81- assert .Equal (t , "bar" , string (impl .Value ))
85+ v , err := impl .Marshal ()
86+ require .NoError (t , err )
87+ assert .Equal (t , "bar" , string (v ))
8288 assert .Equal (t , map [string ]string {"name" : "bob" , "expiry" : "2027-03-01" }, impl .Metadata ())
8389 })
8490 t .Run ("from STDIN JSON with value and metadata" , func (t * testing.T ) {
@@ -90,7 +96,9 @@ func Test_rootCommand(t *testing.T) {
9096 require .NoError (t , err )
9197 impl , ok := s .(* pass.PassValue )
9298 require .True (t , ok )
93- assert .Equal (t , "bar" , string (impl .Value ))
99+ v , err := impl .Marshal ()
100+ require .NoError (t , err )
101+ assert .Equal (t , "bar" , string (v ))
94102 assert .Equal (t , map [string ]string {"name" : "bob" }, impl .Metadata ())
95103 })
96104 t .Run ("from STDIN JSON merged with --metadata flag wins on collision" , func (t * testing.T ) {
@@ -102,7 +110,9 @@ func Test_rootCommand(t *testing.T) {
102110 require .NoError (t , err )
103111 impl , ok := s .(* pass.PassValue )
104112 require .True (t , ok )
105- assert .Equal (t , "bar" , string (impl .Value ))
113+ v , err := impl .Marshal ()
114+ require .NoError (t , err )
115+ assert .Equal (t , "bar" , string (v ))
106116 assert .Equal (t , map [string ]string {"name" : "alice" , "extra" : "thing" }, impl .Metadata ())
107117 })
108118 t .Run ("invalid --metadata flag (no =)" , func (t * testing.T ) {
@@ -129,8 +139,8 @@ func Test_rootCommand(t *testing.T) {
129139 t .Run ("list" , func (t * testing.T ) {
130140 t .Run ("ok" , func (t * testing.T ) {
131141 mock := teststore .NewMockStore (teststore .WithStore (map [store.ID ]store.Secret {
132- store .MustParseID ("foo" ): & pass.PassValue { Value : []byte ("bar" )} ,
133- store .MustParseID ("baz" ): & pass.PassValue { Value : []byte ("0" )} ,
142+ store .MustParseID ("foo" ): pass .NewPassValue ( []byte ("bar" )) ,
143+ store .MustParseID ("baz" ): pass .NewPassValue ( []byte ("0" )) ,
134144 }))
135145 out , err := executeCommand (Root (t .Context (), mock , mockInfo ), "list" )
136146 assert .NoError (t , err )
@@ -147,8 +157,8 @@ func Test_rootCommand(t *testing.T) {
147157 t .Run ("rm" , func (t * testing.T ) {
148158 t .Run ("ok (two secrets)" , func (t * testing.T ) {
149159 mock := teststore .NewMockStore (teststore .WithStore (map [store.ID ]store.Secret {
150- store .MustParseID ("foo" ): & pass.PassValue { Value : []byte ("bar" )} ,
151- store .MustParseID ("baz" ): & pass.PassValue { Value : []byte ("0" )} ,
160+ store .MustParseID ("foo" ): pass .NewPassValue ( []byte ("bar" )) ,
161+ store .MustParseID ("baz" ): pass .NewPassValue ( []byte ("0" )) ,
152162 }))
153163 out , err := executeCommand (Root (t .Context (), mock , mockInfo ), "rm" , "foo" , "baz" )
154164 assert .NoError (t , err )
@@ -159,8 +169,8 @@ func Test_rootCommand(t *testing.T) {
159169 })
160170 t .Run ("--all" , func (t * testing.T ) {
161171 mock := teststore .NewMockStore (teststore .WithStore (map [store.ID ]store.Secret {
162- store .MustParseID ("foo" ): & pass.PassValue { Value : []byte ("bar" )} ,
163- store .MustParseID ("baz" ): & pass.PassValue { Value : []byte ("0" )} ,
172+ store .MustParseID ("foo" ): pass .NewPassValue ( []byte ("bar" )) ,
173+ store .MustParseID ("baz" ): pass .NewPassValue ( []byte ("0" )) ,
164174 }))
165175 out , err := executeCommand (Root (t .Context (), mock , mockInfo ), "rm" , "--all" )
166176 assert .NoError (t , err )
@@ -199,7 +209,7 @@ func Test_rootCommand(t *testing.T) {
199209 t .Run ("get" , func (t * testing.T ) {
200210 t .Run ("ok" , func (t * testing.T ) {
201211 mock := teststore .NewMockStore (teststore .WithStore (map [store.ID ]store.Secret {
202- store .MustParseID ("foo" ): & pass.PassValue { Value : []byte ("bar" )} ,
212+ store .MustParseID ("foo" ): pass .NewPassValue ( []byte ("bar" )) ,
203213 }))
204214 out , err := executeCommand (Root (t .Context (), mock , mockInfo ), "get" , "foo" )
205215 assert .NoError (t , err )
@@ -241,7 +251,7 @@ func Test_rootCommandTelemetry(t *testing.T) {
241251 t .Run (tc .name , func (t * testing.T ) {
242252 spanRecorder , metricReader := testhelper .SetupTelemetry (t )
243253 mock := teststore .NewMockStore (teststore .WithStore (map [store.ID ]store.Secret {
244- store .MustParseID ("baz" ): & pass.PassValue { Value : []byte ("bar" )} ,
254+ store .MustParseID ("baz" ): pass .NewPassValue ( []byte ("bar" )) ,
245255 }))
246256 _ , err := executeCommand (Root (t .Context (), mock , mockInfo ), tc .args ... )
247257 assert .NoError (t , err )
0 commit comments