Beispiel #1
0
    def test_api_base_view(self):
        """
        Test that our custom header parameters get pushed on to the GET QueryDict

        """

        factory = RequestFactory(HTTP_X_ARCHES_VER='2.1')
        view = APIBase.as_view()

        request = factory.get(reverse('surveys'), {'ver': '2.0'})
        request.user = None
        response = view(request)
        self.assertEqual(request.GET.get('ver'), '2.0')

        request = factory.get(reverse('surveys'))
        request.user = None
        response = view(request)
        self.assertEqual(request.GET.get('ver'), '2.1')
Beispiel #2
0
    def test_api_base_view(self):
        """
        Test that our custom header parameters get pushed on to the GET QueryDict

        """

        factory = RequestFactory(HTTP_X_ARCHES_VER="2.1")
        view = APIBase.as_view()

        request = factory.get(reverse("mobileprojects", kwargs={}),
                              {"ver": "2.0"})
        request.user = None
        response = view(request)
        self.assertEqual(request.GET.get("ver"), "2.0")

        request = factory.get(reverse("mobileprojects"), kwargs={})
        request.user = None
        response = view(request)
        self.assertEqual(request.GET.get("ver"), "2.1")