mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
* [chore] Add more tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix most tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix remaining tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix lint issues. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix more lint issues. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix more lint issues. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix the final lint issue. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> --------- Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
35 lines
729 B
Go
35 lines
729 B
Go
package ghssh
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
// Mock GOPASS_HOMEDIR to point to a temp directory
|
|
tempDir := t.TempDir()
|
|
t.Setenv("GOPASS_HOMEDIR", tempDir)
|
|
|
|
c, err := New()
|
|
require.NoError(t, err)
|
|
assert.NotNil(t, c)
|
|
assert.Equal(t, 30*time.Second, c.Timeout)
|
|
assert.NotNil(t, c.disk)
|
|
}
|
|
|
|
func TestCache_String(t *testing.T) {
|
|
// Mock GOPASS_HOMEDIR to point to a temp directory
|
|
tempDir := t.TempDir()
|
|
t.Setenv("GOPASS_HOMEDIR", tempDir)
|
|
|
|
c, err := New()
|
|
require.NoError(t, err)
|
|
assert.NotNil(t, c)
|
|
|
|
assert.Contains(t, c.String(), "Github SSH key cache (OnDisk:")
|
|
assert.Contains(t, c.String(), tempDir)
|
|
}
|