aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/test_flow_export/locust_patch.py
blob: f64e08576b41936b8dd3cdd7040e242e364d9eae (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
25
26
27
28
29
30
31
32
33
34
35
36
37
from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):
    def on_start(self):
        ''' on_start is called when a Locust start before any task is scheduled '''
        self.path()

    @task()
    def path(self):
        url = self.locust.host + '/path'

        headers = {
            'header': 'qvalue',
            'content-length': '7',
        }

        params = {
            'query': 'param',
        }

        data = '''content'''

        self.response = self.client.request(
            method='PATCH',
            url=url,
            headers=headers,
            params=params,
            data=data,
        )

    ### Additional tasks can go here ###


class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 1000
    max_wait = 3000