Why is response.context None in the following tests? I've checked response.content and it is ''. if I remove the assertIsNotNone line I get a TypeError: 'NoneType' object is not subscribable
def test_log_view_with_no_entries(self):
"""
If no logs are available, an appropriate message should be displayed.
"""
response = self.client.get(reverse('swpgr:logs'))
self.assertIsNotNone(response.context)
self.assertEqual(response.status_code, 200)
self.assertContains(response, "No logs are available.")
self.assertQuerysetEqual(response.context['log_list'], [])
def test_log_view_with_one_entry(self):
"""
Logs should be displayed it table.
"""
time = timezone.now()
t = LogEntry.objects.create(event_date=time, command_type="Test", command_source="Test Case",
username="user")
response = self.client.get(reverse('swpgr:logs'))
self.assertIsNotNone(response.context)
self.assertQuerysetEqual(
response.context['log_list'],
['<LogEntry: 1 Test user: user>']
)`