testing/e2e: add API helper for u/pw credentials
This commit is contained in:
1 parent
0b1217fdb6
commit
7dce5396f5
1 file changed
+16
@@ -142,3 +142,19 @@ func CreateNewStaticCredentialJsonCli(t testing.TB, ctx context.Context, credent
|
||||
|
||||
return newCredentialsId
|
||||
}
|
||||
|
||||
// CreateNewStaticCredentialPasswordApi uses the API to create a new password credential in the
|
||||
// provided static credential store.
|
||||
// Returns the id of the new credential
|
||||
func CreateNewStaticCredentialPasswordApi(t testing.TB, ctx context.Context, client *api.Client, credentialStoreId string, user string, password string) string {
|
||||
c := credentials.NewClient(client)
|
||||
newCredentialsResult, err := c.Create(ctx, "username_password", credentialStoreId,
|
||||
credentials.WithUsernamePasswordCredentialUsername(user),
|
||||
credentials.WithUsernamePasswordCredentialPassword(password),
|
||||
)
|
||||
require.NoError(t, err)
|
||||
newCredentialsId := newCredentialsResult.Item.Id
|
||||
t.Logf("Created Username/Password Credentials: %s", newCredentialsId)
|
||||
|
||||
return newCredentialsId
|
||||
}
|
||||
Reference in new issue
Block a user