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

def treq(conn=None):
    if not conn:
        conn = proxy.ClientConnect(("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():
    r = treq()
    return flow.Flow(r)