mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-21 05:53:12 +00:00
Unit test reproducing the bug in the integration test.
This commit is contained in:
parent
1725e99821
commit
3166545509
@ -4757,6 +4757,39 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
|||||||
op_url = self.webish_url + "/operations/134?t=status&output=JSON"
|
op_url = self.webish_url + "/operations/134?t=status&output=JSON"
|
||||||
yield self.assertHTTPError(op_url, 404, "unknown/expired handle '134'")
|
yield self.assertHTTPError(op_url, 404, "unknown/expired handle '134'")
|
||||||
|
|
||||||
|
@inlineCallbacks
|
||||||
|
def test_upload_file_in_directory(self):
|
||||||
|
"""Create a directory, then upload a file into it.
|
||||||
|
|
||||||
|
Unit test reproducer for https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3590
|
||||||
|
"""
|
||||||
|
def req(method, path, **kwargs):
|
||||||
|
return treq.request(method, self.webish_url + path, persistent=False,
|
||||||
|
**kwargs)
|
||||||
|
|
||||||
|
response = yield req("POST", "/uri?format=sdmf&t=mkdir&redirect_to_result=true",
|
||||||
|
browser_like_redirects=True)
|
||||||
|
|
||||||
|
uri = urllib.unquote(response.request.absoluteURI)
|
||||||
|
assert 'URI:DIR2:' in uri
|
||||||
|
dircap = uri[uri.find("URI:DIR2:"):].rstrip('/')
|
||||||
|
dircap_uri = "/uri/{}".format(urllib.quote(dircap))
|
||||||
|
|
||||||
|
# POST a file into this directory
|
||||||
|
FILE_CONTENTS = u"a file in a directory"
|
||||||
|
|
||||||
|
body, headers = self.build_form(t="upload", when_done=".", name="file",
|
||||||
|
file=FILE_CONTENTS)
|
||||||
|
response = yield req(
|
||||||
|
"POST",
|
||||||
|
dircap_uri,
|
||||||
|
data=body,
|
||||||
|
headers=headers,
|
||||||
|
browser_like_redirects=True
|
||||||
|
)
|
||||||
|
if response.code >= 400:
|
||||||
|
raise Error(response.code, response=response.content())
|
||||||
|
|
||||||
def test_incident(self):
|
def test_incident(self):
|
||||||
d = self.POST("/report_incident", details="eek")
|
d = self.POST("/report_incident", details="eek")
|
||||||
def _done(res):
|
def _done(res):
|
||||||
|
Loading…
Reference in New Issue
Block a user