Exemplo n.º 1
0
def test_method_override():
    """
    Verify that the request method is overridden
    from POST to GET if it contains a signed request.
    """
    facebook_middleware = FacebookMiddleware()

    request = request_factory.post(path=reverse("home"), data={"signed_request": TEST_SIGNED_REQUEST})

    facebook_middleware.process_request(request)

    assert request.method == "GET"
Exemplo n.º 2
0
def test_method_override():
    """
    Verify that the request method is overridden
    from POST to GET if it contains a signed request.
    """
    facebook_middleware = FacebookMiddleware()

    request = request_factory.post(
        path=reverse('home'), data={'signed_request': TEST_SIGNED_REQUEST})

    facebook_middleware.process_request(request)

    assert request.method == 'GET'
Exemplo n.º 3
0
    def test_method_override(self):
        """
        Verify that the request method is overridden
        from POST to GET if it contains a signed request.
        """
        facebook_middleware = FacebookMiddleware()

        with patch.object(GraphAPI, "get") as graph_get:
            graph_get.return_value = TEST_GRAPH_ME_RESPONSE

            request = request_factory.post(path=reverse("home"), data={"signed_request": TEST_SIGNED_REQUEST})

            facebook_middleware.process_request(request)

        assert request.method == "GET"
Exemplo n.º 4
0
    def test_method_override(self):
        """
        Verify that the request method is overridden
        from POST to GET if it contains a signed request.
        """
        facebook_middleware = FacebookMiddleware()

        with patch.object(GraphAPI, 'get') as graph_get:
            graph_get.return_value = TEST_GRAPH_ME_RESPONSE

            request = request_factory.post(
                path=reverse('home'),
                data={'signed_request': TEST_SIGNED_REQUEST})

            facebook_middleware.process_request(request)

        assert request.method == 'GET'
Exemplo n.º 5
0
def test_method_override():
    """
    Verify that the request method is overridden
    from POST to GET if it contains a signed request.
    """
    facebook_middleware = FacebookMiddleware()

    with patch.object(GraphAPI, 'get', autospec=True) as graph_get:
        graph_get.return_value = {}

        request = request_factory.post(
            path = reverse('home'),
            data = {
                'signed_request': TEST_SIGNED_REQUEST
            }
        )

        facebook_middleware.process_request(request)

    assert request.method == 'GET'