github.com/argoproj/argo-cd/v3@v3.2.1/util/askpass/server_test.go (about) 1 package askpass 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestAdd(t *testing.T) { 10 s := NewServer(SocketPath) 11 nonce := s.Add("foo", "bar") 12 13 assert.Equal(t, "foo", s.creds[nonce].Username) 14 assert.Equal(t, "bar", s.creds[nonce].Password) 15 } 16 17 func TestRemove(t *testing.T) { 18 s := NewServer(SocketPath) 19 s.creds["some-id"] = Creds{Username: "foo"} 20 21 s.Remove("some-id") 22 23 _, ok := s.creds["some-id"] 24 assert.False(t, ok) 25 }