def test_login_req_user(self): func = Mock(return_value='success') decorat_func = login_require(func) self.request.session['user'] = '******' resp = decorat_func(self.request) self.assertEqual(resp, 'success')
def test_login_req_no_user(self): func = Mock() decorat_func = login_require(func) resp = decorat_func(self.request) assert not func.called