Commit 171781c7 authored by Petr Kalashnikov's avatar Petr Kalashnikov
Browse files

Stylistic changes

parent 113fd80b
Pipeline #52144 passed with stage
in 2 minutes and 13 seconds
......@@ -171,7 +171,7 @@ python -m pytest -m integration
### Stresstesting
Set credentials in `config.yaml` or `config_example.yaml` and run
Set credentials in `config.yaml` and run
```sh
locust -f locust_testing/stresstest.py
......
import time
from locust import HttpUser, TaskSet, task, between
from locust import HttpUser, TaskSet, task, between
import bios
import logging
logger = logging.getLogger(__name__)
ubw_config = bios.read('config_example.yaml')
endpoints_list = ubw_config['rest']['endpoints']
headers = ubw_config['rest']['headers']
ubw_config = bios.read("config_gravitee.yaml")
endpoints_list = ubw_config["rest"]["endpoints"]
headers = ubw_config["rest"]["headers"]
def get_endpoint(endpoint):
return "/" + endpoints_list[endpoint]["url"] + "/"
class WebsiteTasks(TaskSet):
@task(10) #weights can be adjusted in prod
@task(10) # weights can be adjusted in prod
def check_get_arbeidsordre(self):
self.client.get(get_endpoint("arbeidsordre") + "UB/102454100", headers=headers)
......@@ -56,14 +56,16 @@ class WebsiteTasks(TaskSet):
@task(2)
def check_get_perioder(self):
self.client.get(get_endpoint("periode") + "UB?periodType/periodType+eq+GL", headers=headers)
self.client.get(
get_endpoint("periode") + "UB?periodType/periodType+eq+GL", headers=headers
)
@task(2)
def check_get_arbeidsordrer(self):
self.client.get(get_endpoint("arbeidsordre") + "UB", headers=headers)
@task(10)
def check_get_arbeidsordre(self):
def check_get_specific_anlegg(self):
self.client.get(get_endpoint("anlegg") + "UB/102454100", headers=headers)
@task(10)
......@@ -92,15 +94,15 @@ class WebsiteTasks(TaskSet):
@task(5)
def check_get_bilagstyper(self):
req = self.client.get(get_endpoint("bilagstyper") + "UB", headers=headers)
self.client.get(get_endpoint("bilagstyper") + "UB", headers=headers)
@task(10)
def check_get_bilagstype(self):
req = self.client.get(get_endpoint("bilagstyper") + "UB/TT", headers=headers)
self.client.get(get_endpoint("bilagstyper") + "UB/TT", headers=headers)
@task(5)
def check_get_ressursere(self):
req = self.client.get(get_endpoint("ressurser") + "UB", headers=headers)
self.client.get(get_endpoint("ressurser") + "UB", headers=headers)
@task(10)
def check_get_ressurs(self):
......@@ -109,4 +111,4 @@ class WebsiteTasks(TaskSet):
class WebsiteUser(HttpUser):
tasks = [WebsiteTasks]
wait_time = between(5.100, 7.500) #to adjust in prod
wait_time = between(5.100, 7.500) # to adjust in prod
......@@ -5,3 +5,4 @@ pyyaml
coverage
pylint
black
locust
......@@ -18,7 +18,7 @@ commands =
deps =
black
commands =
black --check --diff ubw_client tests setup.py
black --check --diff ubw_client tests setup.py locust_testing
# Linters
[testenv:flake8]
......@@ -32,7 +32,7 @@ deps =
# flake8-import-order
# flake8-docstrings
commands =
flake8 --per-file-ignores="__init__.py:F401" ubw_client
flake8 --per-file-ignores="__init__.py:F401" ubw_client locust_testing
[testenv:bandit]
basepython = python3
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment