21 lines
655 B
Go
21 lines
655 B
Go
package domain
|
|
|
|
import "testing"
|
|
|
|
func TestImmutableRequestReplay_HP_IDEM_02(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
first := HashImmutableRequest([]byte("method\x00target\x00payload"))
|
|
same := HashImmutableRequest([]byte("method\x00target\x00payload"))
|
|
other := HashImmutableRequest([]byte("method\x00other\x00payload"))
|
|
if got := ClassifyReplay(nil, first); got != ReplayNew {
|
|
t.Fatalf("new replay decision = %v", got)
|
|
}
|
|
if got := ClassifyReplay(&first, same); got != ReplayExact {
|
|
t.Fatalf("exact replay decision = %v", got)
|
|
}
|
|
if got := ClassifyReplay(&first, other); got != ReplayConflict {
|
|
t.Fatalf("conflicting replay decision = %v", got)
|
|
}
|
|
}
|