Skip to content

Commit

Permalink
Add TestGetSignerUIDShouldFailForFailResponse ref fibercrypto#139
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevAlDen committed Oct 14, 2019
1 parent c4d7f5f commit 8b04905
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/hardware/sky-wallet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,26 @@ func TestGetSignerUIDShouldFailOnDeviceError(t *testing.T) {
// When
devId := sw.GetSignerUID()

// Then
require.Equal(t, core.UID("undefined"), devId)
}

func TestGetSignerUIDShouldFailForFailResponse(t *testing.T) {
// Giving
dev := mocks.Devicer{}
f := messages.Failure{}
fb, err := proto.Marshal(&f)
require.Nil(t, err)
msg := wire.Message{
Kind: uint16(messages.MessageType_MessageType_Failure),
Data: fb,
}
dev.On("GetFeatures").Return(msg, nil)
sw := NewSkyWallet(&dev)

// When
devId := sw.GetSignerUID()

// Then
require.Equal(t, core.UID("undefined"), devId)
}

0 comments on commit 8b04905

Please sign in to comment.