From 32721fbd8159f28fd0a00a0c3b5ff29ff2fd386e Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Fri, 3 Jan 2020 14:39:11 -0800 Subject: [PATCH] Resolve MR comments --- api/client_test.go | 5 +++++ api/private_test.go | 2 +- api/register_test.go | 6 ++++-- bindings/client_test.go | 3 +++ bots/userDiscovery.go | 3 --- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/api/client_test.go b/api/client_test.go index e322b892d..59d5609b3 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -55,6 +55,7 @@ func TestFormatTextMessage(t *testing.T) { t.Logf("message: %q", msg) } +//Happy path func TestParsedMessage_GetSender(t *testing.T) { pm := ParsedMessage{} sndr := pm.GetSender() @@ -64,6 +65,7 @@ func TestParsedMessage_GetSender(t *testing.T) { } } +//Happy path func TestParsedMessage_GetPayload(t *testing.T) { pm := ParsedMessage{} payload := []byte{0, 1, 2, 3} @@ -75,6 +77,7 @@ func TestParsedMessage_GetPayload(t *testing.T) { } } +//Happy path func TestParsedMessage_GetRecipient(t *testing.T) { pm := ParsedMessage{} rcpt := pm.GetRecipient() @@ -84,6 +87,7 @@ func TestParsedMessage_GetRecipient(t *testing.T) { } } +//Happy path func TestParsedMessage_GetMessageType(t *testing.T) { pm := ParsedMessage{} var typeTest int32 @@ -96,6 +100,7 @@ func TestParsedMessage_GetMessageType(t *testing.T) { } } +//Happy path func TestParse(t *testing.T) { ms := parse.Message{} ms.Body = []byte{0, 1, 2} diff --git a/api/private_test.go b/api/private_test.go index 61c8f725f..815c1d73b 100644 --- a/api/private_test.go +++ b/api/private_test.go @@ -80,7 +80,7 @@ func TestGenerateCmixKeys(t *testing.T) { } -// +//Happy/error path: Tests generation of e2e keys func TestGenerateE2eKeys(t *testing.T) { //Test generateCmixKeys cmixGrp, e2eGrp := generateGroups(def) diff --git a/api/register_test.go b/api/register_test.go index be2e0e95d..7c7438c9f 100644 --- a/api/register_test.go +++ b/api/register_test.go @@ -10,6 +10,7 @@ import ( "testing" ) +//Test that a registered session may be stored & recovered func TestRegistrationGob(t *testing.T) { // Get a Client testClient, err := NewClient(&globals.RamStorage{}, "", "", def) @@ -89,11 +90,11 @@ func TestClient_Register(t *testing.T) { VerifyRegisterGobUser(Session, t) - //Probs can't do this as there is now a sense of randomness?? - //VerifyRegisterGobKeys(Session, testClient.topology, t) + VerifyRegisterGobKeys(Session, testClient.topology, t) disconnectServers() } +//Verify the user from the session make in the registration above matches expected user func VerifyRegisterGobUser(session user.Session, t *testing.T) { expectedUser := id.NewUserFromUint(5, t) @@ -104,6 +105,7 @@ func VerifyRegisterGobUser(session user.Session, t *testing.T) { } } +//Verify that the keys from the session in the registration above match the expected keys func VerifyRegisterGobKeys(session user.Session, topology *connect.Circuit, t *testing.T) { cmixGrp, _ := getGroups() h := sha256.New() diff --git a/bindings/client_test.go b/bindings/client_test.go index 305edea53..66dc1888d 100644 --- a/bindings/client_test.go +++ b/bindings/client_test.go @@ -85,6 +85,7 @@ func TestNewClientNil(t *testing.T) { } } +//Happy path: tests creation of valid client func TestNewClient(t *testing.T) { d := DummyStorage{LocationA: "Blah", StoreA: []byte{'a', 'b', 'c'}} @@ -101,6 +102,7 @@ func TestNewClient(t *testing.T) { } } +//Happy Path: Register with permissioning func TestRegister(t *testing.T) { ndfStr, pubKey := getNDFJSONStr(def, t) @@ -234,6 +236,7 @@ func TestDeleteUsername_EmptyContactList(t *testing.T) { "Contact list should be empty") } +//Happy path: Tests regState gets properly updated along the registration codepath func TestClient_GetRegState(t *testing.T) { ndfStr, pubKey := getNDFJSONStr(def, t) diff --git a/bots/userDiscovery.go b/bots/userDiscovery.go index de35ed218..c819f66bb 100644 --- a/bots/userDiscovery.go +++ b/bots/userDiscovery.go @@ -46,9 +46,6 @@ func Register(valueType, value string, publicKey []byte, regStatus func(int), ti keyFP := fingerprint(publicKey) regStatus(globals.UDB_REG_PUSHKEY) - fmt.Println("keyFp ", keyFP) - fmt.Println("udbId ", UdbID) - fmt.Println("pubLey ", publicKey) // push key and error if it already exists err = pushKey(UdbID, keyFP, publicKey) -- GitLab