from django.contrib.sessions.backends.base import SessionBase
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse

from incuna_test_utils.testcases.integration import BaseIntegrationTestCase
from tests.factories import UserFactory


def view(request, *args, **kwargs):
    return HttpResponse('')


class IntegrationTestCase(BaseIntegrationTestCase):
    user_factory = UserFactory
    view = view

    def test_access_view(self):
        response = self.access_view()
        self.assertIsInstance(response, HttpResponse)

        request = response.request
        self.assertIsInstance(request, WSGIRequest)
        self.assertIsInstance(request.session, SessionBase)

    def test_access_view_request(self):
        request = self.create_request()
        response = self.access_view(request=request)

        self.assertEqual(response.request, request)

        with self.assertRaises(AttributeError):
            response.request.session

@@ -972,8 +972,386 @@
 session%0A
+%0A    def test_assert_count(self):%0A        haystack = %5B1, 1, 3, 1, 2, 4%5D%0A        needle = 1%0A        count = 3%0A        self.assert_count(needle, haystack, count)%0A%0A    def test_assert_count_fail(self):%0A        haystack = %5B1, 1, 3, 1, 2, 4%5D%0A        needle = 1%0A        count = 4%0A%0A        with self.assertRaises(AssertionError):%0A            self.assert_count(needle, haystack, count)%0A

Add tests for BaseIntegrationTestCase.assert_count