Compare commits
No commits in common. "master" and "lash/admin-tool" have entirely different histories.
master
...
lash/admin
File diff suppressed because it is too large
Load Diff
@ -1223,20 +1223,13 @@ func TestVerifyCreatePin(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash the correct PIN
|
|
||||||
hashedPIN, err := pin.HashPIN("1234")
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to hash temporaryPin", "error", err)
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(hashedPIN))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte("1234"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
// Call the method under test
|
// Call the method under test
|
||||||
res, err := h.VerifyCreatePin(ctx, "verify_create_pin", []byte(tt.input))
|
res, err := h.VerifyCreatePin(ctx, "verify_create_pin", []byte(tt.input))
|
||||||
|
|
||||||
@ -1915,13 +1908,13 @@ func TestConfirmPin(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
input []byte
|
input []byte
|
||||||
temporarypin string
|
temporarypin []byte
|
||||||
expectedResult resource.Result
|
expectedResult resource.Result
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Test with correct pin confirmation",
|
name: "Test with correct pin confirmation",
|
||||||
input: []byte("1234"),
|
input: []byte("1234"),
|
||||||
temporarypin: "1234",
|
temporarypin: []byte("1234"),
|
||||||
expectedResult: resource.Result{
|
expectedResult: resource.Result{
|
||||||
FlagReset: []uint32{flag_pin_mismatch},
|
FlagReset: []uint32{flag_pin_mismatch},
|
||||||
},
|
},
|
||||||
@ -1929,21 +1922,14 @@ func TestConfirmPin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
// Hash the PIN
|
|
||||||
hashedPIN, err := pin.HashPIN(tt.temporarypin)
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to hash temporaryPin", "error", err)
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the expected behavior of the mock
|
// Set up the expected behavior of the mock
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(hashedPIN))
|
err := store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(tt.temporarypin))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Call the function under test
|
//Call the function under test
|
||||||
res, _ := h.ConfirmPinChange(ctx, "confirm_pin_change", tt.input)
|
res, _ := h.ConfirmPinChange(ctx, "confirm_pin_change", tt.temporarypin)
|
||||||
|
|
||||||
//Assert that the result set to content is what was expected
|
//Assert that the result set to content is what was expected
|
||||||
assert.Equal(t, res, tt.expectedResult, "Result should contain flags set according to user input")
|
assert.Equal(t, res, tt.expectedResult, "Result should contain flags set according to user input")
|
||||||
|
@ -3,7 +3,7 @@ RELOAD transaction_reset
|
|||||||
CATCH no_voucher flag_no_active_voucher 1
|
CATCH no_voucher flag_no_active_voucher 1
|
||||||
MOUT back 0
|
MOUT back 0
|
||||||
HALT
|
HALT
|
||||||
LOAD validate_recipient 50
|
LOAD validate_recipient 20
|
||||||
RELOAD validate_recipient
|
RELOAD validate_recipient
|
||||||
CATCH invalid_recipient flag_invalid_recipient 1
|
CATCH invalid_recipient flag_invalid_recipient 1
|
||||||
CATCH invite_recipient flag_invalid_recipient_with_invite 1
|
CATCH invite_recipient flag_invalid_recipient_with_invite 1
|
||||||
|
Loading…
Reference in New Issue
Block a user