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="******"))
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='******'))
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="******"))
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='******'))