From b97e2db0d347ac7b749297614f101044b3eecfca Mon Sep 17 00:00:00 2001 From: Mihai Moldovanu Date: Sun, 27 Mar 2022 00:27:40 +0200 Subject: [PATCH 1/2] Fix login test . test for package content too --- sending_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sending_test.go b/sending_test.go index 3ca67da..a734ad7 100644 --- a/sending_test.go +++ b/sending_test.go @@ -3,6 +3,8 @@ package main import ( "net" "testing" + + "github.com/magiconair/properties/assert" ) // Test scafolding @@ -33,11 +35,16 @@ func TestSendLogin(t *testing.T) { sendLogin(client, tt.name, tt.pass) }() - reply := make([]byte, 4096) + reply := make([]byte, tt.resultLenght) length, _ := server.Read(reply) + + // test length of the received packet if length != tt.resultLenght { t.Errorf("Expected length %v, got %v buffer: %v for %s / %s", tt.resultLenght, length, reply[0:length], tt.name, tt.pass) } + + // test content of the packet + assert.Equal(t, reply, tt.resultBuffer, "Login buffers not the same") }) } } -- 2.47.2 From 32850d0f4b607e564a1c6879fd38b3e2e9d67685 Mon Sep 17 00:00:00 2001 From: Mihai Moldovanu Date: Sun, 27 Mar 2022 00:34:39 +0200 Subject: [PATCH 2/2] Deps fix --- go.mod | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d3946db..71804da 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module tfm.ro/elbot go 1.16 -require github.com/spf13/viper v1.8.1 // indirect +require ( + github.com/magiconair/properties v1.8.5 // indirect + github.com/spf13/viper v1.8.1 // indirect +) -- 2.47.2