-
Notifications
You must be signed in to change notification settings - Fork 102
/
admin_setting_customization_integration_test.go
57 lines (45 loc) · 1.68 KB
/
admin_setting_customization_integration_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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package tfe
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestAdminSettings_Customization_Read(t *testing.T) {
skipUnlessEnterprise(t)
client := testClient(t)
ctx := context.Background()
customizationSettings, err := client.Admin.Settings.Customization.Read(ctx)
require.NoError(t, err)
assert.Equal(t, "customization", customizationSettings.ID)
assert.NotNil(t, customizationSettings.SupportEmail)
assert.NotNil(t, customizationSettings.LoginHelp)
assert.NotNil(t, customizationSettings.Footer)
assert.NotNil(t, customizationSettings.Error)
assert.NotNil(t, customizationSettings.NewUser)
}
func TestAdminSettings_Customization_Update(t *testing.T) {
skipUnlessEnterprise(t)
client := testClient(t)
ctx := context.Background()
email := "[email protected]"
loginHelp := "<div>Login Help</div>"
footer := "<p>Custom Footer Content</p>"
customError := "<em>Custom Error Instructions</em>"
newUser := "New user? <a href=\"#\">Click Here</a>"
customizationSettings, err := client.Admin.Settings.Customization.Update(ctx, AdminCustomizationSettingsUpdateOptions{
SupportEmail: String(email),
LoginHelp: String(loginHelp),
Footer: String(footer),
Error: String(customError),
NewUser: String(newUser),
})
require.NoError(t, err)
assert.Equal(t, email, customizationSettings.SupportEmail)
assert.Equal(t, loginHelp, customizationSettings.LoginHelp)
assert.Equal(t, footer, customizationSettings.Footer)
assert.Equal(t, customError, customizationSettings.Error)
assert.Equal(t, newUser, customizationSettings.NewUser)
}