diff --git a/client_test.py b/client_test.py new file mode 100644 index 000000000..196406c2a --- /dev/null +++ b/client_test.py @@ -0,0 +1,9 @@ +import pytest +import server + +@pytest.fixture +def client(): + server.app.config["TESTING"] = True + with server.app.test_client() as client: + yield client + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 139affa05..56f84cb1f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,38 @@ -click==7.1.2 -Flask==1.1.2 -itsdangerous==1.1.0 -Jinja2==2.11.2 -MarkupSafe==1.1.1 -Werkzeug==1.0.1 +bidict==0.23.1 +blinker==1.9.0 +brotli==1.2.0 +certifi==2026.6.17 +charset-normalizer==3.4.7 +click==8.4.2 +ConfigArgParse==1.7.5 +Flask==3.1.3 +flask-cors==6.0.5 +Flask-Login==0.6.3 +gevent==25.9.1 +geventhttpclient==2.3.9 +greenlet==3.5.3 +h11==0.16.0 +idna==3.18 +iniconfig==2.3.0 +itsdangerous==2.2.0 +Jinja2==3.1.6 +locust==2.44.4 +MarkupSafe==3.0.3 +msgpack==1.2.1 +packaging==26.2 +pluggy==1.6.0 +psutil==7.2.2 +Pygments==2.20.0 +pytest==9.1.1 +pytest-flask==1.3.0 +python-engineio==4.13.3 +python-socketio==5.16.3 +pyzmq==27.1.0 +requests==2.34.2 +simple-websocket==1.1.0 +urllib3==2.7.0 +websocket-client==1.9.0 +Werkzeug==3.1.8 +wsproto==1.3.2 +zope.event==6.2 +zope.interface==8.5 diff --git a/server.py b/server.py index 4084baeac..efa34273f 100644 --- a/server.py +++ b/server.py @@ -46,6 +46,9 @@ def purchasePlaces(): competition = [c for c in competitions if c['name'] == request.form['competition']][0] club = [c for c in clubs if c['name'] == request.form['club']][0] placesRequired = int(request.form['places']) + if placesRequired > int(competition['numberOfPlaces']): + flash("Booking incomplete, you cannot book more places than available!") + return render_template("welcome.html", club=club, competitions=competitions) competition['numberOfPlaces'] = int(competition['numberOfPlaces'])-placesRequired flash('Great-booking complete!') return render_template('welcome.html', club=club, competitions=competitions)