Skip to content

Instantly share code, notes, and snippets.

@bodharma
Created October 10, 2018 15:46
Show Gist options
  • Save bodharma/1f53c8a77a3545adadb5790de0c78475 to your computer and use it in GitHub Desktop.
Save bodharma/1f53c8a77a3545adadb5790de0c78475 to your computer and use it in GitHub Desktop.
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