mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Fix dropped errors in SSO tests (#2141)
This commit is contained in:
parent
ed9f890ba0
commit
0a87bbf496
@ -41,11 +41,15 @@ var testResponse = `PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c2FtbHA6
|
||||
func TestValidate(t *testing.T) {
|
||||
tm, err := time.Parse(time.UnixDate, "Sun Apr 30 22:10:00 UTC 2017")
|
||||
require.Nil(t, err)
|
||||
|
||||
clock := dsig.NewFakeClockAt(tm)
|
||||
validator, err := NewValidator(testMetadata, Clock(clock))
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, validator)
|
||||
|
||||
auth, err := DecodeAuthResponse(testResponse)
|
||||
require.Nil(t, err)
|
||||
|
||||
signed, err := validator.ValidateSignature(auth)
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, signed)
|
||||
@ -78,13 +82,18 @@ func tamperedResponse(original string) (string, error) {
|
||||
func TestVerfiyValidTamperedWithDocFails(t *testing.T) {
|
||||
tampered, err := tamperedResponse(testResponse)
|
||||
require.Nil(t, err)
|
||||
|
||||
tm, err := time.Parse(time.UnixDate, "Sun Apr 30 22:10:00 UTC 2017")
|
||||
require.Nil(t, err)
|
||||
|
||||
clock := dsig.NewFakeClockAt(tm)
|
||||
validator, err := NewValidator(testMetadata, Clock(clock))
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, validator)
|
||||
|
||||
auth, err := DecodeAuthResponse(tampered)
|
||||
require.Nil(t, err)
|
||||
|
||||
_, err = validator.ValidateSignature(auth)
|
||||
require.NotNil(t, err)
|
||||
}
|
||||
@ -97,7 +106,10 @@ func TestVerfiyStaleMessageFails(t *testing.T) {
|
||||
validator, err := NewValidator(testMetadata, Clock(clock))
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, validator)
|
||||
|
||||
auth, err := DecodeAuthResponse(testResponse)
|
||||
require.Nil(t, err)
|
||||
|
||||
signed, err := validator.ValidateSignature(auth)
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, signed)
|
||||
|
Loading…
Reference in New Issue
Block a user