test_commands.py 667 B

12345678910111213141516171819202122
  1. import random
  2. from django.core import management
  3. from django.test import TestCase
  4. from ..models import Issue, IssueEvent
  5. class CommandsTestCase(TestCase):
  6. def setUp(self):
  7. random.seed(32423423433)
  8. def test_make_sample_issues(self):
  9. management.call_command("make_sample_issues", issue_quantity=1)
  10. self.assertEqual(Issue.objects.all().count(), 1)
  11. def test_make_sample_issues_multiple(self):
  12. management.call_command(
  13. "make_sample_issues", issue_quantity=2, events_quantity_per=2
  14. )
  15. self.assertEqual(Issue.objects.all().count(), 2)
  16. self.assertEqual(IssueEvent.objects.all().count(), 4)