def test_post(self): p = req_post() p.content = '''content''' p.headers = '' flow = tutils.tflow(req=p) python_equals("test_flow_export/locust_post.py", flow_export.locust_code(flow))
def test_post(self): req_post.content = '''content''' req_post.headers = '' flow = tutils.tflow(req=req_post) result = """ 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' data = '''content''' self.response = self.client.request( method='POST', url=url, data=data, ) ### Additional tasks can go here ### class WebsiteUser(HttpLocust): task_set = UserBehavior min_wait = 1000 max_wait = 3000 """.strip() assert flow_export.locust_code(flow) == result
def test_get(self): flow = tutils.tflow(req=req_get) result = """ 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', } self.response = self.client.request( method='GET', url=url, headers=headers, ) ### Additional tasks can go here ### class WebsiteUser(HttpLocust): task_set = UserBehavior min_wait = 1000 max_wait = 3000 """.strip() assert flow_export.locust_code(flow) == result
def test_patch(self): flow = tutils.tflow(req=req_patch()) python_equals("test_flow_export/locust_patch.py", flow_export.locust_code(flow))