diff --git a/.gitignore b/.gitignore index ac4a47f..17e8b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ constants.py assets/db_schema.sql +/**/__pycache__ diff --git a/app/models.py b/app/models.py index 3e67fc4..8a5b56f 100644 --- a/app/models.py +++ b/app/models.py @@ -273,7 +273,7 @@ class UserRatings(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) game_id = db.Column(db.Integer) user_id = db.Column(db.Integer) - player_id = db.Column(db.Enum("1", "2")) + player_id = db.Column(db.Integer) rating = db.Column(db.String(100)) created = db.Column(db.DateTime, nullable=False, server_default=db.func.now()) modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now()) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/queries_test.py b/tests/queries_test.py new file mode 100644 index 0000000..4dfe2ac --- /dev/null +++ b/tests/queries_test.py @@ -0,0 +1,71 @@ +from app.models import * + + +def test_users(): + deepak = Users.query.filter_by(id=46).first() + assert deepak.email == "deepak@yopmail.com" + + +def test_cities(): + beirut = Cities.query.filter_by(id=12).first() + assert beirut.name == "Beirut" + + +def test_games(): + test = Games.query.filter_by(id=63).first() + assert test.user_id == 255 + + +def test_payments(): + test = Payments.query.filter_by(id=295).first() + assert test.user_id == 260 + + +def test_player_availabilities(): + test = PlayerAvailabilities.query.filter_by(id=256).first() + assert test.game_id == 94 + + +def test_player_cancel_games(): + test = PlayerCancelGames.query.filter_by(id=132).first() + assert test.player_id == 137 + + +def test_purchase_games(): + test = PurchaseGames.query.filter_by(id=268).first() + assert test.game_id == 64 + + +def test_sports(): + test = Sports.query.filter_by(id=4).first() + assert test.name == "Volleyball" + + +def test_teams(): + test = Teams.query.filter_by(id=306).first() + assert test.game_id == 64 + + +def test_user_ratings(): + test = UserRatings.query.filter_by(id=420).first() + assert test.user_id == 21 + + +def test_venue_images(): + test = VenueImages.query.filter_by(id=3).first() + assert test.user_id == 9 + + +def test_venues(): + test = Venues.query.filter_by(id=28).first() + assert test.name == "Santiago BernabĂ©u" + + +def test_view_news(): + test = ViewNews.query.filter_by(id=57).first() + assert test.news_id == 10 + + +def test_web_bookings(): + test = WebBookings.query.filter_by(id=9).first() + assert test.game == "FĂștbol "