mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
[web] TFlow minor improved.
This commit is contained in:
parent
55a58c4c6f
commit
2c38fddea5
@ -281,7 +281,8 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
||||
tflow_json = _json.dumps(
|
||||
app.flow_to_json(tflow.tflow(resp=True, err=True)), indent=4, sort_keys=True
|
||||
)
|
||||
web_root = os.path.join(os.getcwd(), 'web')
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
web_root = os.path.join(here, os.pardir, os.pardir, os.pardir, os.pardir, 'web')
|
||||
tflow_path = os.path.join(web_root, 'src/js/__tests__/ducks/_tflow.js')
|
||||
content = """export default function(){{\n return {tflow_json}\n}}""".format(tflow_json=tflow_json)
|
||||
with open(tflow_path, 'w') as f:
|
||||
|
@ -1,11 +1,11 @@
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import * as Columns from '../../../components/FlowTable/FlowColumns'
|
||||
import _tflow from '../../ducks/_tflow'
|
||||
import { TFlow } from '../../ducks/tutils'
|
||||
|
||||
describe('FlowColumns Components', () => {
|
||||
|
||||
let tflow = _tflow()
|
||||
let tflow = TFlow()
|
||||
it('should render TLSColumn', () => {
|
||||
let tlsColumn = renderer.create(<Columns.TLSColumn flow={tflow}/>),
|
||||
tree = tlsColumn.toJSON()
|
||||
@ -28,25 +28,25 @@ describe('FlowColumns Components', () => {
|
||||
tree = iconColumn.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
// image
|
||||
let imageFlow = _tflow()
|
||||
let imageFlow = TFlow()
|
||||
imageFlow.response.headers = [['Content-Type', 'image/jpeg']]
|
||||
iconColumn = renderer.create(<Columns.IconColumn flow={imageFlow}/>)
|
||||
tree = iconColumn.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
// javascript
|
||||
let jsFlow = _tflow()
|
||||
let jsFlow = TFlow()
|
||||
jsFlow.response.headers = [['Content-Type', 'application/x-javascript']]
|
||||
iconColumn = renderer.create(<Columns.IconColumn flow={jsFlow}/>)
|
||||
tree = iconColumn.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
// css
|
||||
let cssFlow = _tflow()
|
||||
let cssFlow = TFlow()
|
||||
cssFlow.response.headers = [['Content-Type', 'text/css']]
|
||||
iconColumn = renderer.create(<Columns.IconColumn flow={cssFlow}/>)
|
||||
tree = iconColumn.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
// default
|
||||
let fooFlow = _tflow()
|
||||
let fooFlow = TFlow()
|
||||
fooFlow.response.headers = [['Content-Type', 'foo']]
|
||||
iconColumn = renderer.create(<Columns.IconColumn flow={fooFlow}/>)
|
||||
tree = iconColumn.toJSON()
|
||||
@ -83,7 +83,7 @@ describe('FlowColumns Components', () => {
|
||||
})
|
||||
|
||||
it('should render SizeColumn', () => {
|
||||
tflow = _tflow()
|
||||
tflow = TFlow()
|
||||
let sizeColumn = renderer.create(<Columns.SizeColumn flow={tflow}/>),
|
||||
tree = sizeColumn.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
|
@ -112,7 +112,7 @@ exports[`FlowColumns Components should render TimeColumn 1`] = `
|
||||
<td
|
||||
className="col-time"
|
||||
>
|
||||
415322h
|
||||
415381h
|
||||
</td>
|
||||
`;
|
||||
|
||||
|
@ -8,7 +8,7 @@ export default function(){
|
||||
"alpn_proto_negotiated": "http/1.1",
|
||||
"cipher_name": "cipher",
|
||||
"clientcert": null,
|
||||
"id": "75bfd3cd-a084-4d84-a063-b0804dc91342",
|
||||
"id": "4a18d1a0-50a1-48dd-9aa6-d45d74282939",
|
||||
"sni": "address",
|
||||
"ssl_established": false,
|
||||
"timestamp_end": 3.0,
|
||||
@ -18,9 +18,9 @@ export default function(){
|
||||
},
|
||||
"error": {
|
||||
"msg": "error",
|
||||
"timestamp": 1495158272.596447
|
||||
"timestamp": 1495370312.4814785
|
||||
},
|
||||
"id": "8035b342-c916-44f7-93fa-293b40a7d3ad",
|
||||
"id": "d91165be-ca1f-4612-88a9-c0f8696f3e29",
|
||||
"intercepted": false,
|
||||
"marked": false,
|
||||
"modified": false,
|
||||
@ -65,8 +65,8 @@ export default function(){
|
||||
"is_replay": false,
|
||||
"reason": "OK",
|
||||
"status_code": 200,
|
||||
"timestamp_end": 1495158272.5964308,
|
||||
"timestamp_start": 1495158272.5964305
|
||||
"timestamp_end": 1495370312.4814625,
|
||||
"timestamp_start": 1495370312.481462
|
||||
},
|
||||
"server_conn": {
|
||||
"address": [
|
||||
@ -74,7 +74,7 @@ export default function(){
|
||||
22
|
||||
],
|
||||
"alpn_proto_negotiated": null,
|
||||
"id": "9a5d01d7-ede8-4409-b064-230305bfa29d",
|
||||
"id": "f087e7b2-6d0a-41a8-a8f0-e1a4761395f8",
|
||||
"ip_address": [
|
||||
"192.168.0.1",
|
||||
22
|
||||
|
@ -7,3 +7,5 @@ export function createStore(parts) {
|
||||
applyMiddleware(...[thunk])
|
||||
)
|
||||
}
|
||||
|
||||
export { default as TFlow } from './_tflow'
|
||||
|
Loading…
Reference in New Issue
Block a user