forked from hashicorp/go-tfe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_setting_smtp_test.go
43 lines (33 loc) · 987 Bytes
/
admin_setting_smtp_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package tfe
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestAdminSettings_SMTP_Read(t *testing.T) {
skipIfCloud(t)
client := testClient(t)
ctx := context.Background()
smtpSettings, err := client.Admin.Settings.SMTP.Read(ctx)
require.NoError(t, err)
assert.Equal(t, "smtp", smtpSettings.ID)
assert.NotNil(t, smtpSettings.Enabled)
assert.NotNil(t, smtpSettings.Host)
assert.NotNil(t, smtpSettings.Port)
assert.NotNil(t, smtpSettings.Sender)
assert.NotNil(t, smtpSettings.Auth)
assert.NotNil(t, smtpSettings.Username)
}
func TestAdminSettings_SMTP_Update(t *testing.T) {
skipIfCloud(t)
client := testClient(t)
ctx := context.Background()
enabled := false
smtpSettings, err := client.Admin.Settings.SMTP.Update(ctx, AdminSMTPSettingsUpdateOptions{
Enabled: Bool(enabled),
Auth: SMTPAuthValue(SMTPAuthNone),
})
require.NoError(t, err)
assert.Equal(t, enabled, smtpSettings.Enabled)
}