add test for invalid message author

This commit is contained in:
vyzo 2020-04-23 17:22:24 +03:00
parent 96066d320f
commit 9c7bc987f7
1 changed files with 12 additions and 0 deletions

View File

@ -1083,3 +1083,15 @@ func TestPubsubWithAssortedOptions(t *testing.T) {
}
}
}
func TestWithInvalidMessageAuthor(t *testing.T) {
// this test exercises the failure path in the WithMessageAuthor option
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
h := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
_, err := NewFloodSub(ctx, h, WithMessageAuthor("bogotr0n"))
if err == nil {
t.Fatal("expected error")
}
}