File: client_test.go

package info (click to toggle)
glab 1.53.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,936 kB
  • sloc: sh: 295; makefile: 153; perl: 99; ruby: 68; javascript: 67
file content (46 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (2)
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
package api

import (
	"crypto/tls"
	"testing"

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

func Test_tlsConfig(t *testing.T) {
	type args struct {
		host string
	}
	tests := []struct {
		name string
		args args
		want []uint16
	}{
		{
			name: "GitLab.com uses secure ciphers",
			args: args{
				host: "gitlab.com",
			},
			want: []uint16{
				tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
				tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
				tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
				tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
			},
		},
		{
			name: "Other hosts aren't limited to secure ciphers",
			args: args{
				host: "gitlab.selfhosted.com",
			},
			want: nil,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			client := tlsConfig(tt.args.host)

			assert.Equal(t, tt.want, client.CipherSuites)
		})
	}
}