Skip to content

Conversation

@elof-dev
Copy link

Summary

This pull request fixes Issue #2 — clubs could book more places than their available points allowed.

Context

The function purchasePlaces() in server.py did not validate whether a club had enough points before approving a booking.

Changes Made

  • server.py → added a condition in purchasePlaces() to prevent bookings exceeding the club’s available points
  • tests/test_book_point_with_enough_point.py → created to test purchasePlaces() behaviour with and wihtout enough points.
  • a new test file containing:

Testing

  • 2 tests pass successfully using pytest :
    • a test for booking within available points
    • a test for rejecting bookings exceeding available points

Linked Issue

Fix #2

- Updated showSummary() in server.py to handle email validation and error messages
- Modified index.html to display flash messages correctly
- Created tests/ folder with conftest.py and test_show_summary.py for unit testing
- Added .flaskenv for local environment configuration
- Updated .gitignore to include .venv and exclude tests/ folder
- Updated requirements.txt to add pytest dependency
- Updated purchasePlaces() to check if the club has enough points before confirming a booking
- Added a new test file with 2 unit tests to verify point validation logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Clubs should not be able to use more than their points allowed

1 participant