from django.test import TestCase

from useful.tasks import call_management_command


class ManagementCommandTestCase(TestCase):
    """Test calling a management command as a Celery task"""
    def test_management_command(self):
        t = call_management_command.delay('validate')
        self.assertEquals(t.status, 'SUCCESS')

from django.test import TestCase

from useful.tasks import call_management_command


class ManagementCommandTestCase(TestCase):
    """Test calling a management command as a Celery task"""
    def test_success(self):
        t = call_management_command.delay('validate')
        self.assertEquals(t.status, 'SUCCESS')

    def test_failure(self):
        t = call_management_command.delay('somethingrandomthatdoesntexist')
        self.assertEquals(t.status, 'FAILURE')

Add failed management command test
Add failed management command test

  from django.test import TestCase
  
  from useful.tasks import call_management_command
  
  
  class ManagementCommandTestCase(TestCase):
      """Test calling a management command as a Celery task"""
-     def test_management_command(self):
+     def test_success(self):
          t = call_management_command.delay('validate')
          self.assertEquals(t.status, 'SUCCESS')
  
+     def test_failure(self):
+         t = call_management_command.delay('somethingrandomthatdoesntexist')
+         self.assertEquals(t.status, 'FAILURE')
+ 
Add failed management command test
## Code Before:
from django.test import TestCase

from useful.tasks import call_management_command


class ManagementCommandTestCase(TestCase):
    """Test calling a management command as a Celery task"""
    def test_management_command(self):
        t = call_management_command.delay('validate')
        self.assertEquals(t.status, 'SUCCESS')

## Instruction:
Add failed management command test
## Code After:
from django.test import TestCase

from useful.tasks import call_management_command


class ManagementCommandTestCase(TestCase):
    """Test calling a management command as a Celery task"""
    def test_success(self):
        t = call_management_command.delay('validate')
        self.assertEquals(t.status, 'SUCCESS')

    def test_failure(self):
        t = call_management_command.delay('somethingrandomthatdoesntexist')
        self.assertEquals(t.status, 'FAILURE')
