From 1867353b9288a8ec59d8107048d0230fe48bf6ab Mon Sep 17 00:00:00 2001 From: zionhigt Date: Fri, 1 Apr 2022 13:59:31 +0200 Subject: [PATCH] LOCUST env --- .gitignore | 3 ++- templates/index.html | 12 ++++++--- tests/perform_test/test_server.py | 42 +++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 tests/perform_test/test_server.py diff --git a/.gitignore b/.gitignore index 8b4d1421a..ed0a87bc9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ lib .envrc __pycache__ launch_flask.bat -launch_test.bat \ No newline at end of file +launch_test.bat +.coverage \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index a99c1943d..926526b7d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,12 +1,16 @@ - - - Document + GUDLFT Registration - ul>l*5 +

Welcome to the GUDLFT Registration Portal!

+ Please enter your secretary email to continue: +
+ + + +
\ No newline at end of file diff --git a/tests/perform_test/test_server.py b/tests/perform_test/test_server.py new file mode 100644 index 000000000..8a921172b --- /dev/null +++ b/tests/perform_test/test_server.py @@ -0,0 +1,42 @@ +import time +from random import randint +from locust import HttpUser, task, between + +from server import loadClubs, loadCompetitions + +competitions = loadCompetitions() +clubs = loadClubs() + +class User(HttpUser): + wait_time = between(1, 5) + + @task + def home(self): + self.client.get("/") + + def logout(self): + self.client.get("/logout") + + @task + def connect(self): + club = clubs[randint(0, len(clubs) - 1)] + self.client.post("/showSummary", {"email":club.get("email")}) + self.client.post("/showSummary", {"email":"not_exist@test.com"}) + + @task(3) + def getBooking(self): + competition = competitions[randint(0, len(competitions) - 1)] + club = clubs[randint(0, len(clubs) - 1)] + self.client.get(f'/book/{competition.get("name")}/{club.get("name")}') + + @task + def purchasePlaces(self): + competition = competitions[randint(0, len(competitions) - 1)] + club = clubs[randint(0, len(clubs) - 1)] + body = { + "club": club.get("name"), + "competition": competition.get("name"), + "places": randint(1, 13) + } + self.client.post("/purchasePlaces", body) + \ No newline at end of file