Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 使用@login\u必需的修饰符进行单元测试_Unit Testing_Google App Engine_Tipfy_Werkzeug - Fatal编程技术网

Unit testing 使用@login\u必需的修饰符进行单元测试

Unit testing 使用@login\u必需的修饰符进行单元测试,unit-testing,google-app-engine,tipfy,werkzeug,Unit Testing,Google App Engine,Tipfy,Werkzeug,我在我的项目中使用tipfy和gae。 我编写单元测试,我将面临一个问题: 如何测试具有@login\u所需装饰器的处理程序 class TestHandler(unittest.TestCase): def setUp(self): self.app = App(rules=rules, config=config, debug=True) self.client = self.app.get_test_client() def test

我在我的项目中使用tipfy和gae。 我编写单元测试,我将面临一个问题: 如何测试具有@login\u所需装饰器的处理程序

class TestHandler(unittest.TestCase): 
    def setUp(self): 
        self.app = App(rules=rules, config=config, debug=True) 
        self.client = self.app.get_test_client() 
    def test_my_handler(self): 
        r = self.client.post('/service') 
        # hardworking 
        self.assertTrue(r.status_code == 200) 
如何为当前处理程序(“/service”)设置“self.auth.user”

问候、感谢和抱歉我的英语)


Oleg

可能太晚了,但我发现了这个可能太晚了,但我发现了这个