mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 18:03:50 +00:00
[web] Update tests.
This commit is contained in:
parent
6560b0dcdb
commit
3f497640ab
@ -186,7 +186,7 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
|||||||
f.response.headers["Content-Encoding"] = "ran\x00dom"
|
f.response.headers["Content-Encoding"] = "ran\x00dom"
|
||||||
f.response.headers["Content-Disposition"] = 'inline; filename="filename.jpg"'
|
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.body == b"message"
|
||||||
assert r.headers["Content-Encoding"] == "random"
|
assert r.headers["Content-Encoding"] == "random"
|
||||||
assert r.headers["Content-Disposition"] == 'attachment; filename="filename.jpg"'
|
assert r.headers["Content-Disposition"] == 'attachment; filename="filename.jpg"'
|
||||||
@ -194,17 +194,17 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
|||||||
del f.response.headers["Content-Disposition"]
|
del f.response.headers["Content-Disposition"]
|
||||||
f.request.path = "/foo/bar.jpg"
|
f.request.path = "/foo/bar.jpg"
|
||||||
assert self.fetch(
|
assert self.fetch(
|
||||||
"/flows/42/response/content"
|
"/flows/42/response/_content"
|
||||||
).headers["Content-Disposition"] == 'attachment; filename=bar.jpg'
|
).headers["Content-Disposition"] == 'attachment; filename=bar.jpg'
|
||||||
|
|
||||||
f.response.content = b""
|
f.response.content = b""
|
||||||
assert self.fetch("/flows/42/response/content").code == 400
|
assert self.fetch("/flows/42/response/_content").code == 400
|
||||||
|
|
||||||
f.revert()
|
f.revert()
|
||||||
|
|
||||||
def test_update_flow_content(self):
|
def test_update_flow_content(self):
|
||||||
assert self.fetch(
|
assert self.fetch(
|
||||||
"/flows/42/request/content",
|
"/flows/42/request/_content",
|
||||||
method="POST",
|
method="POST",
|
||||||
body="new"
|
body="new"
|
||||||
).code == 200
|
).code == 200
|
||||||
@ -222,7 +222,7 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
|||||||
b'--somefancyboundary--\r\n'
|
b'--somefancyboundary--\r\n'
|
||||||
)
|
)
|
||||||
assert self.fetch(
|
assert self.fetch(
|
||||||
"/flows/42/request/content",
|
"/flows/42/request/_content",
|
||||||
method="POST",
|
method="POST",
|
||||||
headers={"Content-Type": 'multipart/form-data; boundary="somefancyboundary"'},
|
headers={"Content-Type": 'multipart/form-data; boundary="somefancyboundary"'},
|
||||||
body=body
|
body=body
|
||||||
|
@ -13,7 +13,7 @@ exports[`ContentViewOptions Component should render correctly 1`] = `
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
className="btn btn-default btn-xs"
|
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."
|
title="Download the content of the flow."
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
|
@ -17,7 +17,7 @@ exports[`ViewImage Component should render correctly 1`] = `
|
|||||||
<img
|
<img
|
||||||
alt="preview"
|
alt="preview"
|
||||||
className="img-thumbnail"
|
className="img-thumbnail"
|
||||||
src="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
|
src="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/_content"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
exports[`DownloadContentButton Component should render correctly 1`] = `
|
exports[`DownloadContentButton Component should render correctly 1`] = `
|
||||||
<a
|
<a
|
||||||
className="btn btn-default btn-xs"
|
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."
|
title="Download the content of the flow."
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
|
@ -54,7 +54,7 @@ exports[`ContentTooLarge Components should render correctly 1`] = `
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
className="btn btn-default btn-xs"
|
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."
|
title="Download the content of the flow."
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
|
@ -265,7 +265,7 @@ exports[`Request Component should render correctly 1`] = `
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
className="btn btn-default btn-xs"
|
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."
|
title="Download the content of the flow."
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
@ -528,7 +528,7 @@ exports[`Response Component should render correctly 1`] = `
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
className="btn btn-default btn-xs"
|
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."
|
title="Download the content of the flow."
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
|
@ -49,7 +49,7 @@ exports[`ContentView Component should render correctly with content too large 1`
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
className="btn btn-default btn-xs"
|
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."
|
title="Download the content of the flow."
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
|
@ -25,15 +25,15 @@ describe('MessageUtils', () => {
|
|||||||
let msg = "foo", view = "bar",
|
let msg = "foo", view = "bar",
|
||||||
flow = { request: msg, id: 1}
|
flow = { request: msg, id: 1}
|
||||||
expect(utils.MessageUtils.getContentURL(flow, msg, view)).toEqual(
|
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(
|
expect(utils.MessageUtils.getContentURL(flow, msg, '')).toEqual(
|
||||||
"/flows/1/request/content"
|
"/flows/1/request/_content"
|
||||||
)
|
)
|
||||||
// response
|
// response
|
||||||
flow = {response: msg, id: 2}
|
flow = {response: msg, id: 2}
|
||||||
expect(utils.MessageUtils.getContentURL(flow, msg, view)).toEqual(
|
expect(utils.MessageUtils.getContentURL(flow, msg, view)).toEqual(
|
||||||
"/flows/2/response/content/bar"
|
"/flows/2/response/content/bar.json"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user