mock-user 883 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. from sentry.runner import configure
  3. configure()
  4. import argparse
  5. def main(username, newsletter_consent_prompt=None):
  6. from sentry.models.user import User
  7. user = User.objects.get(username__iexact=username)
  8. if newsletter_consent_prompt is not None:
  9. user.flags.newsletter_consent_prompt = newsletter_consent_prompt
  10. user.save()
  11. if __name__ == "__main__":
  12. parser = argparse.ArgumentParser()
  13. parser.add_argument("username", default=None, nargs="?")
  14. parser.add_argument(
  15. "--newsletter-consent-prompt", dest="newsletter_consent_prompt", action="store_true"
  16. )
  17. parser.add_argument(
  18. "--no-newsletter-consent-prompt", dest="newsletter_consent_prompt", action="store_false"
  19. )
  20. args = parser.parse_args()
  21. main(username=args.username, newsletter_consent_prompt=args.newsletter_consent_prompt)