[web] Update tests.

This commit is contained in:
Matthew Shao 2017-08-15 22:23:21 +08:00
parent 6560b0dcdb
commit 3f497640ab
8 changed files with 15 additions and 15 deletions

View File

@ -186,7 +186,7 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
f.response.headers["Content-Encoding"] = "ran\x00dom"
f.response.headers["Content-Disposition"] = 'inline; filename="filename.jpg"'
r = self.fetch("/flows/42/response/content")
r = self.fetch("/flows/42/response/_content")
assert r.body == b"message"
assert r.headers["Content-Encoding"] == "random"
assert r.headers["Content-Disposition"] == 'attachment; filename="filename.jpg"'
@ -194,17 +194,17 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
del f.response.headers["Content-Disposition"]
f.request.path = "/foo/bar.jpg"
assert self.fetch(
"/flows/42/response/content"
"/flows/42/response/_content"
).headers["Content-Disposition"] == 'attachment; filename=bar.jpg'
f.response.content = b""
assert self.fetch("/flows/42/response/content").code == 400
assert self.fetch("/flows/42/response/_content").code == 400
f.revert()
def test_update_flow_content(self):
assert self.fetch(
"/flows/42/request/content",
"/flows/42/request/_content",
method="POST",
body="new"
).code == 200
@ -222,7 +222,7 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
b'--somefancyboundary--\r\n'
)
assert self.fetch(
"/flows/42/request/content",
"/flows/42/request/_content",
method="POST",
headers={"Content-Type": 'multipart/form-data; boundary="somefancyboundary"'},
body=body

View File

@ -13,7 +13,7 @@ exports[`ContentViewOptions Component should render correctly 1`] = `
 
<a
className="btn btn-default btn-xs"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
title="Download the content of the flow."
>
<i

View File

@ -17,7 +17,7 @@ exports[`ViewImage Component should render correctly 1`] = `
<img
alt="preview"
className="img-thumbnail"
src="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
src="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
/>
</div>
`;

View File

@ -3,7 +3,7 @@
exports[`DownloadContentButton Component should render correctly 1`] = `
<a
className="btn btn-default btn-xs"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
title="Download the content of the flow."
>
<i

View File

@ -54,7 +54,7 @@ exports[`ContentTooLarge Components should render correctly 1`] = `
 
<a
className="btn btn-default btn-xs"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
title="Download the content of the flow."
>
<i

View File

@ -265,7 +265,7 @@ exports[`Request Component should render correctly 1`] = `
 
<a
className="btn btn-default btn-xs"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/request/content"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/request/_content"
title="Download the content of the flow."
>
<i
@ -528,7 +528,7 @@ exports[`Response Component should render correctly 1`] = `
 
<a
className="btn btn-default btn-xs"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
title="Download the content of the flow."
>
<i

View File

@ -49,7 +49,7 @@ exports[`ContentView Component should render correctly with content too large 1`
 
<a
className="btn btn-default btn-xs"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
title="Download the content of the flow."
>
<i

View File

@ -25,15 +25,15 @@ describe('MessageUtils', () => {
let msg = "foo", view = "bar",
flow = { request: msg, id: 1}
expect(utils.MessageUtils.getContentURL(flow, msg, view)).toEqual(
"/flows/1/request/content/bar"
"/flows/1/request/content/bar.json"
)
expect(utils.MessageUtils.getContentURL(flow, msg, '')).toEqual(
"/flows/1/request/content"
"/flows/1/request/_content"
)
// response
flow = {response: msg, id: 2}
expect(utils.MessageUtils.getContentURL(flow, msg, view)).toEqual(
"/flows/2/response/content/bar"
"/flows/2/response/content/bar.json"
)
})
})