From a6ef43c637150b40b61880d89de88b64704584ac Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 1 Feb 2017 02:25:28 -0800 Subject: [PATCH] format, tests --- standardricochetservice.go | 3 +-- standardricochetservice_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/standardricochetservice.go b/standardricochetservice.go index 71f88b9..a3688e4 100644 --- a/standardricochetservice.go +++ b/standardricochetservice.go @@ -181,8 +181,7 @@ func (srs *StandardRicochetService) OnFailedError(oc *OpenConnection, channelID oc.RejectOpenChannel(channelID, "FailedError") } -// Getters - +// RGetServerHostname returns the generated tor hostname from the private key func (srs *StandardRicochetService) GetServerHostname() string { return srs.serverHostname } \ No newline at end of file diff --git a/standardricochetservice_test.go b/standardricochetservice_test.go index 41bb91b..c7eb21e 100644 --- a/standardricochetservice_test.go +++ b/standardricochetservice_test.go @@ -105,3 +105,14 @@ func TestServerCouldNotConnect(t *testing.T) { t.Errorf("Should not have been been able to connect to 127.0.0.1:65535|kwke2hntvyfqm7dr") } } + +func TestGetServerHostname(t *testing.T) { + ricochetService := new(TestService) + err := ricochetService.Init("./private_key") + if err != nil { + t.Errorf("Could not initate ricochet service: %v", err) + } + if ricochetService.GetServerHostname() != "kwke2hntvyfqm7dr" { + t.Errorf("GetServerHostname did not return expected 'kwke2hntvyfqm7dr'") + } +} \ No newline at end of file