func UserDupName(t *testing.T, store vsafedb.AddUserRunner) { u := vsafe.User{Name: "foo"} if err := store.AddUser(nil, &u); err != nil { t.Fatal("Error adding user.") } if err := store.AddUser(nil, &u); err == nil { t.Error("Expected error adding duplicate user name.") } }
func createUser( t *testing.T, store vsafedb.AddUserRunner, toBeAdded *vsafe.User, result *vsafe.User) { *result = *toBeAdded if err := store.AddUser(nil, result); err != nil { t.Fatalf("Got %v adding to store", err) } if result.Id == 0 { t.Error("Expected Id to be set.") } }