我们正在为我们的塔架应用程序设置控制器测试。我做了一个非常简单的控制器和一个非常简单的测试。测试结果如下:
class TestMainController(TestController):
def test_index(self):
response = self.app.get(url(controller='main', action='index', var1 = '1'), params={'var2':'2'})
print response.req
assert False
Meanwhile, the controller looks something like this:
class MainController(BaseController):
def index(self):
print request
print request.params
For some reason, when we run this code, we get the following output:
-------------------- >> begin captured stdout << ---------------------
GET /_test_vars HTTP/1.0
Host: localhost:80
<Request at 0x36d6950 GET http://localhost/_test_vars>
UnicodeMultiDict([])
GET /main/index/?var1=1&var2=2 HTTP/1.0
Host: localhost:80
--------------------- >> end captured stdout << ----------------------
The TestApp thinks its sending the proper request, but the request that hits the controller is wrong. Anyone have any idea what's going on here? We're dead in the water on tests at the moment.