from locust import HttpLocust, TaskSet, task


class UserBehavior(TaskSet):
    @task(1)
    def wizard_sequence(self):
        # files => enctype=multipart/form-data
        self.client.post('/site_characterization/', files={
            'project_name': (None, 'Amazon Fresno'),
            'system_type': (None, '0'),
            'module_type': (None, '96 Cell'),
            'building_height': (None, '30'),
            'building_width': (None, '600'),
            'building_length': (None, '1500'),
            'building_parapet_height': (None, '0'),
            'wind_speed': (None, '110'),
            'exposure_category': (None, 'C'),
            'exposure_category_transition_distance': (None, '0'),
            'ballast_block_weight': (None, '14.0'),
            'max_system_pressure': (None, '12.0'),
            'anchor_type': (None, 'OMG PowerGrip Plus'),
            'design_spectral_response': (None, '0'),
            'importance_factor': (None, '1'),
        })
        self.client.get('/array_summary/')
        self.client.post('/array_summary/', files={'dxf_upload': open('Fresno First Half.dxf', 'rb')})


class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 500
    max_wait = 5000


# locust -f locustfile.py --host=http://localhost:5000
