test_commands.py 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import random
  2. from django.core import management
  3. from django.test import TestCase
  4. from events.models import Event
  5. class CommandsTestCase(TestCase):
  6. def setUp(self):
  7. random.seed(32423423433)
  8. def test_make_sample_issues(self):
  9. """ Default is one random event """
  10. management.call_command("make_sample_issues")
  11. self.assertEqual(Event.objects.all().count(), 1)
  12. def test_make_sample_issues_multiple(self):
  13. """ Default is one random event """
  14. management.call_command("make_sample_issues", quantity=10)
  15. self.assertEqual(Event.objects.all().count(), 10)
  16. def test_make_sample_issues_real(self):
  17. """ Default is one random event """
  18. management.call_command("make_sample_issues", only_real=True, quantity=2)
  19. self.assertEqual(Event.objects.all().count(), 2)
  20. def test_make_sample_issues_fake(self):
  21. """ Default is one random event """
  22. management.call_command("make_sample_issues", only_fake=True)
  23. self.assertEqual(Event.objects.all().count(), 1)