fix tests for new inits

This commit is contained in:
Dan Ballard 2017-02-09 08:03:48 -08:00
parent 08433db912
commit 77794be7db
5 changed files with 12 additions and 12 deletions

View File

@ -36,6 +36,6 @@ func (ebs *EchoBotService) OnChatMessage(oc *goricochet.OpenConnection, channelI
func main() { func main() {
ricochetService := new(EchoBotService) ricochetService := new(EchoBotService)
ricochetService.Init("./private_key") ricochetService.InitFromKeyFile("./private_key")
ricochetService.Listen(ricochetService, 12345) ricochetService.Listen(ricochetService, 12345)
} }

View File

@ -77,7 +77,7 @@ func (ts *TestBadUsageService) IsKnownContact(hostname string) bool {
func TestBadUsageServer(t *testing.T) { func TestBadUsageServer(t *testing.T) {
ricochetService := new(TestBadUsageService) ricochetService := new(TestBadUsageService)
err := ricochetService.Init("./private_key") err := ricochetService.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
@ -88,7 +88,7 @@ func TestBadUsageServer(t *testing.T) {
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
ricochetService2 := new(TestBadUsageService) ricochetService2 := new(TestBadUsageService)
err = ricochetService2.Init("./private_key") err = ricochetService2.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)

View File

@ -55,7 +55,7 @@ func (ts *TestService) IsKnownContact(hostname string) bool {
func TestServer(t *testing.T) { func TestServer(t *testing.T) {
ricochetService := new(TestService) ricochetService := new(TestService)
err := ricochetService.Init("./private_key") err := ricochetService.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
@ -66,7 +66,7 @@ func TestServer(t *testing.T) {
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
ricochetService2 := new(TestService) ricochetService2 := new(TestService)
err = ricochetService2.Init("./private_key") err = ricochetService2.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
@ -87,7 +87,7 @@ func TestServer(t *testing.T) {
func TestServerInvalidKey(t *testing.T) { func TestServerInvalidKey(t *testing.T) {
ricochetService := new(TestService) ricochetService := new(TestService)
err := ricochetService.Init("./private_key.does.not.exist") err := ricochetService.InitFromKeyFile("./private_key.does.not.exist")
if err == nil { if err == nil {
t.Errorf("Should not have initate ricochet service, private key should not exist") t.Errorf("Should not have initate ricochet service, private key should not exist")
@ -96,7 +96,7 @@ func TestServerInvalidKey(t *testing.T) {
func TestServerCouldNotConnect(t *testing.T) { func TestServerCouldNotConnect(t *testing.T) {
ricochetService := new(TestService) ricochetService := new(TestService)
err := ricochetService.Init("./private_key") err := ricochetService.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
} }
@ -108,7 +108,7 @@ func TestServerCouldNotConnect(t *testing.T) {
func TestGetServerHostname(t *testing.T) { func TestGetServerHostname(t *testing.T) {
ricochetService := new(TestService) ricochetService := new(TestService)
err := ricochetService.Init("./private_key") err := ricochetService.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
} }

View File

@ -32,7 +32,7 @@ func (ts *TestUnauthorizedService) OnFailedChannelOpen(oc *OpenConnection, chann
func TestUnauthorizedClientReject(t *testing.T) { func TestUnauthorizedClientReject(t *testing.T) {
ricochetService := new(TestService) ricochetService := new(TestService)
err := ricochetService.Init("./private_key") err := ricochetService.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
@ -43,7 +43,7 @@ func TestUnauthorizedClientReject(t *testing.T) {
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
ricochetService2 := new(TestUnauthorizedService) ricochetService2 := new(TestUnauthorizedService)
err = ricochetService2.Init("./private_key") err = ricochetService2.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)

View File

@ -29,7 +29,7 @@ func (ts *TestUnknownContactService) IsKnownContact(hostname string) bool {
func TestUnknownContactServer(t *testing.T) { func TestUnknownContactServer(t *testing.T) {
ricochetService := new(StandardRicochetService) ricochetService := new(StandardRicochetService)
err := ricochetService.Init("./private_key") err := ricochetService.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)
@ -40,7 +40,7 @@ func TestUnknownContactServer(t *testing.T) {
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
ricochetService2 := new(TestUnknownContactService) ricochetService2 := new(TestUnknownContactService)
err = ricochetService2.Init("./private_key") err = ricochetService2.InitFromKeyFile("./private_key")
if err != nil { if err != nil {
t.Errorf("Could not initate ricochet service: %v", err) t.Errorf("Could not initate ricochet service: %v", err)