Skip to content

Commit

Permalink
Fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Waldz committed Apr 29, 2020
1 parent b8caee5 commit 7767184
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions services/openvpn/service/auth_handler_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 The "MysteriumNetwork/node" Authors.
* Copyright (C) 2017 The "MysteriumNetwork/node" Authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -39,7 +39,7 @@ var (
)

func TestValidateReturnsFalseWhenNoSessionFound(t *testing.T) {
validator := mockAuthHandler(identity.Identity{}).validate
validator := createAuthHandler(identity.Identity{}).validate

authenticated, err := validator(1, "not important", "not important")

Expand All @@ -48,7 +48,7 @@ func TestValidateReturnsFalseWhenNoSessionFound(t *testing.T) {
}

func TestValidateReturnsFalseWhenSignatureIsInvalid(t *testing.T) {
validator := mockAuthHandlerWithSession(identity.FromAddress("wrongsignature"), sessionExisting).validate
validator := createAuthHandlerWithSession(identity.FromAddress("wrongsignature"), sessionExisting).validate

authenticated, err := validator(1, sessionExistingString, "not important")

Expand All @@ -57,7 +57,7 @@ func TestValidateReturnsFalseWhenSignatureIsInvalid(t *testing.T) {
}

func TestValidateReturnsTrueWhenSessionExistsAndSignatureIsValid(t *testing.T) {
validator := mockAuthHandlerWithSession(identityExisting, sessionExisting).validate
validator := createAuthHandlerWithSession(identityExisting, sessionExisting).validate

authenticated, err := validator(1, sessionExistingString, "not important")

Expand All @@ -66,7 +66,7 @@ func TestValidateReturnsTrueWhenSessionExistsAndSignatureIsValid(t *testing.T) {
}

func TestValidateReturnsTrueWhenSessionExistsAndSignatureIsValidAndClientIDDiffers(t *testing.T) {
validator := mockAuthHandlerWithSession(identityExisting, sessionExisting).validate
validator := createAuthHandlerWithSession(identityExisting, sessionExisting).validate

validator(1, sessionExistingString, "not important")
authenticated, err := validator(2, sessionExistingString, "not important")
Expand All @@ -76,7 +76,7 @@ func TestValidateReturnsTrueWhenSessionExistsAndSignatureIsValidAndClientIDDiffe
}

func TestValidateReturnsTrueWhenSessionExistsAndSignatureIsValidAndClientIDMatches(t *testing.T) {
validator := mockAuthHandlerWithSession(identityExisting, sessionExisting).validate
validator := createAuthHandlerWithSession(identityExisting, sessionExisting).validate

validator(1, sessionExistingString, "not important")
authenticated, err := validator(1, sessionExistingString, "not important")
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestSecondClientIsNotDisconnectedWhenFirstClientDisconnects(t *testing.T) {
}

mockMangement := &management.MockConnection{CommandResult: "SUCCESS"}
middleware := mockAuthHandlerWithSession(identityExisting, sessionExisting)
middleware := createAuthHandlerWithSession(identityExisting, sessionExisting)
middleware.Start(mockMangement)

feedLinesToMiddleware(middleware, firstClientConnected)
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestSecondClientWithTheSameCredentialsIsConnected(t *testing.T) {
}

mockMangement := &management.MockConnection{CommandResult: "SUCCESS"}
middleware := mockAuthHandlerWithSession(identityExisting, sessionExisting)
middleware := createAuthHandlerWithSession(identityExisting, sessionExisting)
middleware.Start(mockMangement)

feedLinesToMiddleware(middleware, firstClientConnected)
Expand Down
4 changes: 2 additions & 2 deletions services/openvpn/service/auth_mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/mysteriumnetwork/node/session"
)

func mockAuthHandler(identityToExtract identity.Identity) *authHandler {
func createAuthHandler(identityToExtract identity.Identity) *authHandler {
mockExtractor := &mockIdentityExtractor{
identityToExtract,
nil,
Expand All @@ -34,7 +34,7 @@ func mockAuthHandler(identityToExtract identity.Identity) *authHandler {
return newAuthHandler(NewClientMap(mockSessions), mockExtractor)
}

func mockAuthHandlerWithSession(identityToExtract identity.Identity, sessionInstance session.Session) *authHandler {
func createAuthHandlerWithSession(identityToExtract identity.Identity, sessionInstance session.Session) *authHandler {
mockExtractor := &mockIdentityExtractor{
identityToExtract,
nil,
Expand Down

0 comments on commit 7767184

Please sign in to comment.