I would like to write a test case like:
# Create fake request with missing header that we are testing for
request = HttpRequest()
request.META = {}
response = MyApp.views.start(request)
self.assertEqual(400, response.status_code, "Unexpected response code")
When I run the above code I see the following error message:
AttributeError: 'module' object has no attribute 'views'
I am a Python newbie and am clearly doing this wrong. Can anyone point how what the error is?
Thanks. -Raj
You haven't shown your imports, or included the full traceback, which makes it harder to work out what's going wrong.
Changing
import myapp
to
import myapp.views
might work.