From 7f215e86c46b8851fc8a194ca8111a02b3ff8e4e Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 3 Jan 2018 10:20:53 -0800 Subject: [PATCH] Adding Open Connection Failed Test --- ricochet_test.go | 7 +++++++ testing.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ricochet_test.go b/ricochet_test.go index dcce6dc..1fa609e 100644 --- a/ricochet_test.go +++ b/ricochet_test.go @@ -52,3 +52,10 @@ func TestRicochetOpenWithError(t *testing.T) { t.Errorf("Open should have failed because of bad version negotiation.") } } + +func TestRicochetOpenWithNoServer(t *testing.T) { + _, err := Open("127.0.0.1:11002|abcdefghijklmno.onion") + if err == nil { + t.Errorf("Open should have failed because of bad version negotiation.") + } +} diff --git a/testing.md b/testing.md index db403eb..04c7b6f 100644 --- a/testing.md +++ b/testing.md @@ -10,7 +10,7 @@ links it to the automated test that exercises that functionality. File: [iricochet_test.go](./ricochet_test.go) -This stub test exercises the Open() function. `TestRicochetOpen`, `TestRicochetOpenWithError`. +This stub test exercises the Open() function. `TestRicochetOpen`, and in cases where the server returns a bad version, `TestRicochetOpenWithError`, and where there is no server at all `TestRicochetOpenWithNoServer` - in both cases Open should return an error. ## Inbound