File: caps_test.go

package info (click to toggle)
golang-github-smallstep-crypto 0.57.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,284 kB
  • sloc: sh: 53; makefile: 36
file content (29 lines) | stat: -rw-r--r-- 763 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
package tpm

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"go.step.sm/crypto/tpm/algorithm"
)

func Test_Capabilities_SupportsAlgorithm(t *testing.T) {
	caps := &Capabilities{}
	assert.False(t, caps.SupportsAlgorithm(algorithm.AlgorithmRSA))

	caps = &Capabilities{
		Algorithms: []algorithm.Algorithm{algorithm.AlgorithmRSA},
	}
	assert.True(t, caps.SupportsAlgorithm(algorithm.AlgorithmRSA))
}

func Test_Capabilities_SupportsAlgorithms(t *testing.T) {
	caps := &Capabilities{}
	assert.False(t, caps.SupportsAlgorithms([]algorithm.Algorithm{algorithm.AlgorithmRSA}))

	caps = &Capabilities{
		Algorithms: []algorithm.Algorithm{algorithm.AlgorithmRSA},
	}
	assert.True(t, caps.SupportsAlgorithms([]algorithm.Algorithm{algorithm.AlgorithmRSA}))
}