Fix login test . test for package content too
This commit is contained in:
parent
ccbc80f104
commit
b97e2db0d3
@ -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")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user