File: test_context_processors.py

package info (click to toggle)
social-auth-app-django 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 304 kB
  • sloc: python: 1,482; makefile: 26
file content (21 lines) | stat: -rw-r--r-- 727 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-
from django.test import TestCase, RequestFactory, override_settings

from social_django.context_processors import login_redirect


@override_settings(REDIRECT_FIELD_NAME='next')
class TestContextProcessors(TestCase):
    def setUp(self):
        self.request_factory = RequestFactory()

    def test_login_redirect_unicode_quote(self):
        request = self.request_factory.get('/', data={'next': 'profile/sjó'})
        result = login_redirect(request)
        self.assertEqual(
            result,  {
                 'REDIRECT_FIELD_NAME': 'next',
                 'REDIRECT_FIELD_VALUE': 'profile/sj%C3%B3',
                 'REDIRECT_QUERYSTRING': 'next=profile/sj%C3%B3'
            }
        )