示例#1
0
 def test_getUpcomingGames(self):
     db.DBConnection.UpcomingGames.remove({})
     _match = upcoming_match(away_att=77,
                             away_def=67,
                             away_mid=69,
                             away_odds_n=0.27669516494195245,
                             away_odds_nn=3.2583333333333333,
                             away_team_name="Sampdoria",
                             away_team_rank=11,
                             away_team_received=2,
                             away_team_scored=1,
                             date=today,
                             draw_odds_n=0.31504895018143103,
                             draw_odds_nn=2.8616666666666664,
                             home_att=80,
                             home_def=71,
                             home_mid=74,
                             home_odds_n=0.4082558848766165,
                             home_odds_nn=2.208333333333333,
                             home_team_name="Fiorentina",
                             home_team_rank=18,
                             home_team_received=1,
                             home_team_scored=2,
                             league="Serie",
                             round=1)
     db.insertMatchToUpcomingGames(_match)
     dtos = db.getUpcomingGames(league='all')
     self.assertEqual(_match, dtos[0])
示例#2
0
 def test_insertMatchToUpcomingGames(self):
     db.DBConnection.UpcomingGames.remove({})
     _match = upcoming_match(away_att=77,
                             away_def=67,
                             away_mid=69,
                             away_odds_n=0.27669516494195245,
                             away_odds_nn=3.2583333333333333,
                             away_team_name="Sampdoria",
                             away_team_rank=11,
                             away_team_received=2,
                             away_team_scored=1,
                             date=today,
                             draw_odds_n=0.31504895018143103,
                             draw_odds_nn=2.8616666666666664,
                             home_att=80,
                             home_def=71,
                             home_mid=74,
                             home_odds_n=0.4082558848766165,
                             home_odds_nn=2.208333333333333,
                             home_team_name="Fiorentina",
                             home_team_rank=18,
                             home_team_received=1,
                             home_team_scored=2,
                             league="Serie",
                             round=1)
     db.insertMatchToUpcomingGames(_match)
     record = db.DBConnection.UpcomingGames.find_one(
         {}, projection={'_id': False})
     record = db.convertStrtoDate(record)
     found = upcoming_match.from_dict(record)
     self.assertEqual(_match, found)