equal
deleted
inserted
replaced
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 |
18 |
19 import os, os.path as osp, glob |
19 import os, os.path as osp, glob |
|
20 import urllib |
20 |
21 |
21 from cubicweb.devtools.testlib import CubicWebTC |
22 from cubicweb.devtools.testlib import CubicWebTC |
22 from cubicweb.devtools.httptest import CubicWebServerTC |
23 from cubicweb.devtools.httptest import CubicWebServerTC |
23 from cubicweb.etwist.server import host_prefixed_baseurl |
24 from cubicweb.etwist.server import host_prefixed_baseurl |
24 |
25 |
55 'http://localhost:8080/hg/') |
56 'http://localhost:8080/hg/') |
56 |
57 |
57 |
58 |
58 class ETwistHTTPTC(CubicWebServerTC): |
59 class ETwistHTTPTC(CubicWebServerTC): |
59 def test_put_content(self): |
60 def test_put_content(self): |
60 body = 'hop' |
61 data = {'hip': 'hop'} |
|
62 headers = {'Content-Type': 'application/x-www-form-urlencoded'} |
|
63 body = urllib.urlencode(data) |
61 response = self.web_request('?vid=put', method='PUT', body=body) |
64 response = self.web_request('?vid=put', method='PUT', body=body) |
|
65 self.assertEqual(body, response.body) |
|
66 response = self.web_request('?vid=put', method='POST', body=body, |
|
67 headers=headers) |
62 self.assertEqual(body, response.body) |
68 self.assertEqual(body, response.body) |
63 |
69 |
64 if __name__ == '__main__': |
70 if __name__ == '__main__': |
65 from logilab.common.testlib import unittest_main |
71 from logilab.common.testlib import unittest_main |
66 unittest_main() |
72 unittest_main() |