2020-08-26 13:58:46 -04:00
|
|
|
package target
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/boundary/internal/db"
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
2021-06-22 22:26:26 -04:00
|
|
|
// TestCredentialLibrary creates a CredentialLibrary for targetId and
|
|
|
|
|
// libraryId.
|
2021-09-30 09:17:27 -04:00
|
|
|
func TestCredentialLibrary(t *testing.T, conn *db.DB, targetId, libraryId string) *CredentialLibrary {
|
2021-06-22 22:26:26 -04:00
|
|
|
t.Helper()
|
|
|
|
|
require := require.New(t)
|
|
|
|
|
rw := db.New(conn)
|
|
|
|
|
lib, err := NewCredentialLibrary(targetId, libraryId)
|
|
|
|
|
require.NoError(err)
|
|
|
|
|
err = rw.Create(context.Background(), lib)
|
|
|
|
|
require.NoError(err)
|
|
|
|
|
return lib
|
|
|
|
|
}
|