示例#1
0
    def test_unmask(self):
        mw = MasqueradeMiddleware()

        request = Mock(spec=HttpRequest)
        request.session = {}
        request.user = User.objects.get(username="******")

        mw.process_request(request)

        self.assert_(request.user.is_masked == False)
        self.assert_(request.user == User.objects.get(username="******"))
示例#2
0
    def test_unmask(self):
        mw = MasqueradeMiddleware()

        request = Mock(spec=HttpRequest)
        request.session = {}
        request.user = User.objects.get(username='******')

        mw.process_request(request)

        self.assert_(request.user.is_masked == False)
        self.assert_(request.user == User.objects.get(username='******'))
示例#3
0
    def test_mask(self):
        mw = MasqueradeMiddleware()

        request = Mock(spec=HttpRequest)
        request.session = {"mask_user": "******"}
        request.user = User.objects.get(username="******")

        mw.process_request(request)

        self.assert_(request.user.is_masked == True)
        self.assert_(request.user == User.objects.get(username="******"))
示例#4
0
    def test_mask(self):
        mw = MasqueradeMiddleware()

        request = Mock(spec=HttpRequest)
        request.session = {'mask_user': '******'}
        request.user = User.objects.get(username='******')

        mw.process_request(request)

        self.assert_(request.user.is_masked == True)
        self.assert_(request.user == User.objects.get(username='******'))