aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils.py
blob: b63c48dc273661d6a7ab41dd494df162b5b7f0b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from libmproxy import proxy, utils, filt, flow

def treq(conn=None):
    if not conn:
        conn = proxy.ClientConnection(("address", 22))
    headers = utils.Headers()
    headers["header"] = ["qvalue"]
    return proxy.Request(conn, "host", 80, "http", "GET", "/path", headers, "content")


def tresp(req=None):
    if not req:
        req = treq()
    headers = utils.Headers()
    headers["header_response"] = ["svalue"]
    return proxy.Response(req, 200, "message", headers, "content_response")


def tflow():
    bc = proxy.ClientConnection(("address", 22))
    return flow.Flow(bc)