Created
October 10, 2018 15:46
-
-
Save bodharma/1f53c8a77a3545adadb5790de0c78475 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from locust import HttpLocust, TaskSet, task | |
| import logging, sys | |
| from credentials import * | |
| class LoginWithUniqueUsersSteps(TaskSet): | |
| email = "NOT_FOUND" | |
| password = "NOT_FOUND" | |
| def on_start(self): | |
| if len(USER_CREDENTIALS) > 0: | |
| self.email, self.password = USER_CREDENTIALS.pop() | |
| @task | |
| def login(self): | |
| self.client.post("/login", { | |
| 'email': self.email, 'password': self.password | |
| }) | |
| logging.info('Login with %s email and %s password', self.email, self.password) | |
| class LoginWithUniqueUsersTest(HttpLocust): | |
| task_set = LoginWithUniqueUsersSteps | |
| host = "http://blazedemo.com" | |
| sock = None | |
| def __init__(self): | |
| super(LoginWithUniqueUsersTest, self).__init__() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment