from django.test import Client

from locust import HttpLocust, TaskSet, task


class UserActions(TaskSet):

    def on_start(self):
        self.login()


    def login(self):
        # login to the application
        response = self.client.get('/')


    @task(1)
    def index(self):
        self.client.get('/')


    @task(2)
    def first_page(self):
        self.client.get('/more/')

    @task(10)
    def get_second_page(self):
        self.client.get('/details/3/')


class ApplicationUser(HttpLocust):
    task_set = UserActions
    min_wait = 5000
    max_wait = 15000
    host = 'http://localhost:5000'
