File: group_security_settings_test.go

package info (click to toggle)
golang-gitlab-gitlab-org-api-client-go 0.123.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,356 kB
  • sloc: makefile: 17
file content (34 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
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
package gitlab

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestGroupSecuritySettings_UpdateSecretPushProtectionEnabledSetting(t *testing.T) {
	mux, client := setup(t)

	mux.HandleFunc("/api/v4/groups/1/security_settings", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, http.MethodPut)
		fmt.Fprint(w, `{
			"secret_push_protection_enabled": true,
			"errors": []
		}`)
	})

	want := &GroupSecuritySettings{
		SecretPushProtectionEnabled: true,
		Errors:                      []string{},
	}

	d, resp, err := client.GroupSecuritySettings.UpdateSecretPushProtectionEnabledSetting(1, UpdateGroupSecuritySettingsOptions{
		SecretPushProtectionEnabled: Ptr(true),
		ProjectsToExclude:           Ptr([]int{1, 2}),
	})
	require.NoError(t, err)
	require.NotNil(t, resp)
	require.Equal(t, want, d)
}