tordam

A library for peer discovery inside the Tor network
git clone https://git.parazyd.org/tordam
Log | Files | Refs | README | LICENSE

commit 57fb6208d110d21a5b5ae5bfd0dcc6939e516d03
parent 4a243dbcda09078c75236333aa81479e614b6968
Author: parazyd <parazyd@dyne.org>
Date:   Mon, 11 Dec 2017 22:37:38 +0100

Add test case for invalid onion address in first handshake.

Diffstat:
Mcmd/dam-dir/main_test.go | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/cmd/dam-dir/main_test.go b/cmd/dam-dir/main_test.go @@ -154,6 +154,7 @@ func TestValidSecondHandshake(t *testing.T) { } func TestInvalidNodetypeFirst(t *testing.T) { + t.SkipNow() vals := ValidFirst vals["nodetype"] = "foobar" resp, err := postReq(vals) @@ -173,6 +174,29 @@ func TestInvalidNodetypeFirst(t *testing.T) { t.Fatal("Server replied:", m.Secret) } } + +func TestInvalidAddressFirst(t *testing.T) { + t.SkipNow() + vals := ValidFirst + vals["address"] = "foobar.onion" + resp, err := postReq(vals) + if err != nil { + t.Fatal(err) + } + if resp.StatusCode != 400 { + t.Fatal("Server did not respond with HTTP 400") + } + m, err := getRespText(resp) + if err != nil { + t.Fatal(err) + } + if m.Secret == "Request is not valid." { + t.Log("Server replied:", m.Secret) + } else { + t.Fatal("Server replied:", m.Secret) + } +} + func TestMain(m *testing.M) { //cmd := exec.Command("./dam-dir") //cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}