func (s *AdminSuite) deleteByEmailTests(adm t.TestAdmin, c *gc.C) error { if err := admin.DeleteByEmail(s.d, adm.Email); err != nil { c.Logf("failed to delete admin %q", adm.Email) return err } err := admin.IsAdminEmail(s.d, adm.Email) c.Assert(err, gc.ErrorMatches, fmt.Sprintf("admin for email %s: user not found", adm.Email)) return nil }
func cliDelete(d db.DB) cli.CommandFunc { return func(args ...string) (cli.Response, error) { if len(args) != 1 { return "", errors.New("delete takes an email as its arg") } if err := admin.DeleteByEmail(d, args[0]); err != nil { return "", err } return cli.Response(fmt.Sprintf("admin %s deleted ok", args[0])), nil } }