File: cipher_suite_go114_test.go

package info (click to toggle)
golang-github-pion-dtls-v3 3.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,124 kB
  • sloc: makefile: 4
file content (36 lines) | stat: -rw-r--r-- 938 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
35
36
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT

//go:build go1.14
// +build go1.14

package dtls

import (
	"testing"

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

func TestInsecureCipherSuites(t *testing.T) {
	assert.Empty(t, InsecureCipherSuites(), "Expected no insecure ciphersuites")
}

func TestCipherSuites(t *testing.T) {
	ours := allCipherSuites()
	theirs := CipherSuites()
	assert.Equal(t, len(ours), len(theirs))

	for i, s := range ours {
		i := i
		s := s
		t.Run(s.String(), func(t *testing.T) {
			cipher := theirs[i]
			assert.Equal(t, cipher.ID, uint16(s.ID()))
			assert.Equal(t, cipher.Name, s.String())
			assert.Equal(t, 1, len(cipher.SupportedVersions), "Expected SupportedVersion to be 1")
			assert.Equal(t, uint16(VersionDTLS12), cipher.SupportedVersions[0], "Expected SupportedVersion to match")
			assert.False(t, cipher.Insecure, "Expected Insecure")
		})
	}
}