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

@ -47,6 +47,7 @@ func (a *Accountant) RegisterAccount(name string) (acc Account, err error) {
// Set the account ID to a new UUID
acc.Id = uuid.New()
acc.Name = name
// Verify this acount isn't already registered
for _, a := range a.Accounts {

View file

@ -21,7 +21,7 @@ func TestAccountant_RegisterAccount(t *testing.T) {
// Start by making two accounts
namea := "one"
namea := uuid.New().String()
acca, err := accountant.RegisterAccount(namea)
if err != nil {
t.Error(err)
@ -29,7 +29,7 @@ func TestAccountant_RegisterAccount(t *testing.T) {
t.Errorf("Missmatched account name after register, expected: %s, actual: %s", namea, acca.Name)
}
nameb := "two"
nameb := uuid.New().String()
accb, err := accountant.RegisterAccount(nameb)
if err != nil {
t.Error(err)
@ -55,7 +55,7 @@ func TestAccountant_LoadSave(t *testing.T) {
t.Error("New accountant created with non-zero account number")
}
name := "one"
name := uuid.New().String()
a, err := accountant.RegisterAccount(name)
if err != nil {
t.Error(err)
@ -97,7 +97,7 @@ func TestAccountant_AssignPrimary(t *testing.T) {
t.Error("New accountant created with non-zero account number")
}
name := "one"
name := uuid.New().String()
a, err := accountant.RegisterAccount(name)
if err != nil {
t.Error(err)