from django.conf import settings
from django.test import TestCase as DjangoTestCase
import fudge

class TestCase(DjangoTestCase):
    def setUp(self):
        self._original_settings = settings

    def tearDown(self):
        settings = self._original_settings


from django.conf import settings
from django.http import HttpRequest
from django.test import TestCase as DjangoTestCase
import fudge

def with_fake_request(func):
    def inner(self, *args, **kwargs):
        request = fudge.Fake(HttpRequest)
        fudge.clear_calls()

        result = func(self, request, *args, **kwargs)

        fudge.verify()
        fudge.clear_expectations()
        return result
    return inner

class TestCase(DjangoTestCase):
    def setUp(self):
        self._original_settings = settings

    def tearDown(self):
        settings = self._original_settings


Add in a decorator for generating fake request objects for test cases
Add in a decorator for generating fake request objects for test cases

  from django.conf import settings
+ from django.http import HttpRequest
  from django.test import TestCase as DjangoTestCase
  import fudge
+ 
+ def with_fake_request(func):
+     def inner(self, *args, **kwargs):
+         request = fudge.Fake(HttpRequest)
+         fudge.clear_calls()
+ 
+         result = func(self, request, *args, **kwargs)
+ 
+         fudge.verify()
+         fudge.clear_expectations()
+         return result
+     return inner
  
  class TestCase(DjangoTestCase):
      def setUp(self):
          self._original_settings = settings
  
      def tearDown(self):
          settings = self._original_settings
  
  
Add in a decorator for generating fake request objects for test cases
## Code Before:
from django.conf import settings
from django.test import TestCase as DjangoTestCase
import fudge

class TestCase(DjangoTestCase):
    def setUp(self):
        self._original_settings = settings

    def tearDown(self):
        settings = self._original_settings


## Instruction:
Add in a decorator for generating fake request objects for test cases
## Code After:
from django.conf import settings
from django.http import HttpRequest
from django.test import TestCase as DjangoTestCase
import fudge

def with_fake_request(func):
    def inner(self, *args, **kwargs):
        request = fudge.Fake(HttpRequest)
        fudge.clear_calls()

        result = func(self, request, *args, **kwargs)

        fudge.verify()
        fudge.clear_expectations()
        return result
    return inner

class TestCase(DjangoTestCase):
    def setUp(self):
        self._original_settings = settings

    def tearDown(self):
        settings = self._original_settings

