sghorbal commited on
Commit
6e4fbac
·
1 Parent(s): 356f8cf

add a persistent match in test db

Browse files
Files changed (1) hide show
  1. tests/conftest.py +58 -0
tests/conftest.py CHANGED
@@ -740,6 +740,64 @@ def nouveau_joueur(db_session):
740
 
741
  return player
742
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
  @pytest.fixture
744
  def roland_garros_final():
745
  """
 
740
 
741
  return player
742
 
743
+ @pytest.fixture
744
+ def wimbledon_final(db_session):
745
+ """
746
+ Create a Wimbledon final match with odds and new players
747
+ """
748
+ from src.entity.match import Match
749
+ from src.entity.odds import Odds
750
+ from src.entity.player import Player
751
+
752
+ match = Match(
753
+ date="2019-06-15",
754
+ comment="Completed",
755
+ winner=Player(name="Federer R."),
756
+ loser=Player(name="Djokovic N."),
757
+ tournament_name="Wimbledon",
758
+ tournament_series="Grand Slam",
759
+ tournament_surface="Grass",
760
+ tournament_court="Outdoor",
761
+ tournament_round="The Final",
762
+ tournament_location="London",
763
+ winner_rank=1,
764
+ winner_points=4000,
765
+ loser_rank=2,
766
+ loser_points=3000,
767
+ )
768
+ match.odds = [
769
+ Odds(
770
+ bookmaker="B365",
771
+ winner=1.2,
772
+ loser=4.5,
773
+ match=match
774
+ ),
775
+ Odds(
776
+ bookmaker="PS",
777
+ winner=1.22,
778
+ loser=4.52,
779
+ match=match
780
+ ),
781
+ Odds(
782
+ bookmaker="Max",
783
+ winner=1.24,
784
+ loser=4.55,
785
+ match=match
786
+ ),
787
+ Odds(
788
+ bookmaker="Avg",
789
+ winner=1.21,
790
+ loser=4.7,
791
+ match=match
792
+ ),
793
+ ]
794
+
795
+ # Add the match to the database
796
+ db_session.add(match)
797
+ db_session.commit()
798
+
799
+ return match
800
+
801
  @pytest.fixture
802
  def roland_garros_final():
803
  """