예제 #1
0
// Ensure a user can be removed.
func TestData_DropUser(t *testing.T) {
	var data meta.Data
	if err := data.CreateUser("susy", "", false); err != nil {
		t.Fatal(err)
	} else if err := data.CreateUser("bob", "", false); err != nil {
		t.Fatal(err)
	}

	if err := data.DropUser("bob"); err != nil {
		t.Fatal(err)
	} else if !reflect.DeepEqual(data.Users, []meta.UserInfo{
		{Name: "susy"},
	}) {
		t.Fatalf("unexpected users: %#v", data.Users)
	}
}
예제 #2
0
// Ensure that removing a non-existent user returns an error.
func TestData_DropUser_ErrUserNotFound(t *testing.T) {
	var data meta.Data
	if err := data.DropUser("bob"); err != meta.ErrUserNotFound {
		t.Fatal(err)
	}
}