Fix tests and actually use the account name

This commit is contained in:
Marc Di Luzio 2020-06-02 18:06:34 +01:00
parent 42534ac545
commit 4c76530832
3 changed files with 12 additions and 7 deletions

View file

@ -4,6 +4,8 @@ package rove
import (
"testing"
"github.com/google/uuid"
)
var serverUrl = "localhost:80"
@ -23,7 +25,8 @@ func TestStatus(t *testing.T) {
func TestRegister(t *testing.T) {
conn := NewConnection(serverUrl)
reg1, err := conn.Register("one")
a := uuid.New().String()
reg1, err := conn.Register(a)
if err != nil {
t.Errorf("Register returned error: %s", err)
} else if !reg1.Success {
@ -32,7 +35,8 @@ func TestRegister(t *testing.T) {
t.Error("Server returned empty registration ID")
}
reg2, err := conn.Register("two")
b := uuid.New().String()
reg2, err := conn.Register(b)
if err != nil {
t.Errorf("Register returned error: %s", err)
} else if !reg2.Success {
@ -41,7 +45,7 @@ func TestRegister(t *testing.T) {
t.Error("Server returned empty registration ID")
}
if reg2, err := conn.Register("one"); err != nil {
if reg2, err := conn.Register(a); err != nil {
t.Errorf("Register returned error: %s", err)
} else if reg2.Success {
t.Error("Server should have failed to register duplicate name")