Example #1
0
def test_generate_signed_request():
    signed_request = SignedRequest(
        signed_request = TEST_SIGNED_REQUEST,
        application_secret_key = TEST_FACEBOOK_APPLICATION_SECRET_KEY
    )

    signed_request = signed_request.generate()
Example #2
0
    def test_signed_request_renewal(self):
        """
        Verify that users are redirected to renew their signed requests
        once they expire.
        """
        client = Client()

        signed_request = SignedRequest(TEST_SIGNED_REQUEST, TEST_APPLICATION_SECRET)
        signed_request.user.oauth_token.expires_at = now() - timedelta(days=1)

        response = client.get(path=reverse("home"), data={"signed_request": signed_request.generate()})

        # There's no way to derive the view the response originated from in Django,
        # so verifying its status code will have to suffice.
        assert response.status_code == 401
Example #3
0
    def test_signed_request_renewal(self):
        """
        Verify that users are redirected to renew their signed requests
        once they expire.
        """
        client = Client()

        signed_request = SignedRequest(TEST_SIGNED_REQUEST,
                                       TEST_APPLICATION_SECRET)
        signed_request.user.oauth_token.expires_at = now() - timedelta(days=1)

        response = client.get(
            path=reverse('home'),
            data={'signed_request': signed_request.generate()})

        # There's no way to derive the view the response originated from in Django,
        # so verifying its status code will have to suffice.
        assert response.status_code == 401
Example #4
0
def test_generate_signed_request():
    signed_request = SignedRequest(
        signed_request=TEST_SIGNED_REQUEST,
        application_secret_key=TEST_FACEBOOK_APPLICATION_SECRET_KEY)

    signed_request = signed_request.generate()