MCPcopy Index your code
hub / github.com/coder/coder / TestValidate

Function TestValidate

coderd/awsidentity/awsidentity_test.go:35–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33)
34
35func TestValidate(t *testing.T) {
36 t.Parallel()
37 t.Run("FailEmpty", func(t *testing.T) {
38 t.Parallel()
39 _, err := awsidentity.Validate("", "", nil)
40 require.Error(t, err)
41 })
42 t.Run("FailBad", func(t *testing.T) {
43 t.Parallel()
44 _, err := awsidentity.Validate(signature, "{}", nil)
45 require.ErrorIs(t, err, rsa.ErrVerification)
46 })
47 t.Run("Success", func(t *testing.T) {
48 t.Parallel()
49 identity, err := awsidentity.Validate(signature, document, nil)
50 require.NoError(t, err)
51 require.Equal(t, awsidentity.Other, identity.Region)
52 })
53}

Callers

nothing calls this directly

Calls 4

ValidateFunction · 0.92
RunMethod · 0.65
ErrorMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected