Exemplo n.º 1
0
 def test_is_home_in_possession(self):
     DBSetup().g62_status_empty()
     last_game: Gameinfo = Gameinfo.objects.last()
     last_game.in_possession = 'A1'
     liveticker = Liveticker(last_game)
     assert liveticker.is_home_in_possession()
     assert not liveticker.is_away_in_possession()
Exemplo n.º 2
0
 def test_liveticker_get_time_when_gameStarted_is_set(self):
     DBSetup().g62_status_empty()
     last_game = Gameinfo.objects.last()
     last_game.gameStarted = '12:00'
     last_game.status = '1st Half'
     last_game.save()
     liveticker = Liveticker(Gameinfo.objects.last())
     assert liveticker.get_time() == '12:00'
Exemplo n.º 3
0
 def test_liveticker_get_all_ticks(self):
     DBSetup().g62_status_empty()
     last_game = Gameinfo.objects.last()
     home = Gameresult.objects.get(gameinfo=last_game, isHome=True)
     away = Gameresult.objects.get(gameinfo=last_game, isHome=False)
     DBSetup().create_teamlog_home_and_away(home=home.team,
                                            away=away.team,
                                            gameinfo=last_game)
     liveticker = Liveticker(last_game)
     liveticker.collect_all_ticks()
     ticks = liveticker.get_ticks()
     assert len(ticks) == TeamLog.objects.all().count()
Exemplo n.º 4
0
 def test_liveticker_get_ticks(self):
     DBSetup().g62_status_empty()
     last_game = Gameinfo.objects.last()
     home = Gameresult.objects.get(gameinfo=last_game, isHome=True)
     away = Gameresult.objects.get(gameinfo=last_game, isHome=False)
     DBSetup().create_teamlog_home_and_away(home=home.team,
                                            away=away.team,
                                            gameinfo=last_game)
     teamlog_entry: TeamLog = TeamLog.objects.filter(
         gameinfo=last_game).order_by('-created_time').first()
     # workaround to get test stable due to fast creation of teamlog entries
     if teamlog_entry.team is None or teamlog_entry.event == 'Spielzeit':
         is_home = None
     else:
         is_home = 'home' if teamlog_entry.team.name == home.team.name else 'away'
     liveticker = Liveticker(last_game)
     ticks = liveticker.get_ticks()
     assert len(ticks) == 5
     assert ticks[0] == Tick(teamlog_entry, is_home).as_json()
Exemplo n.º 5
0
 def test_game_with_no_team_logs(self):
     DBSetup().g62_status_empty()
     last_game = Gameinfo.objects.filter(status='Geplant').last()
     liveticker = Liveticker(last_game)
     assert liveticker.as_json() == {
         "gameId": last_game.pk,
         "status": "Geplant",
         "standing": "Gruppe 2",
         "time": "10:00",
         "home": {
             "name": "BBBBBBB3",
             "score": 1,
             "isInPossession": False,
         },
         "away": {
             "name": "BBBBBBB1",
             "score": 3,
             "isInPossession": False,
         },
         "ticks": [],
     }
Exemplo n.º 6
0
 def test_liveticker_get_status_when_gameStarted_empty(self):
     DBSetup().g62_status_empty()
     liveticker = Liveticker(
         Gameinfo.objects.filter(status='Geplant').last())
     assert liveticker.get_status() == 'Geplant'
Exemplo n.º 7
0
 def test_liveticker_get_empty_ticks_with_no_team_logs(self):
     DBSetup().g62_status_empty()
     liveticker = Liveticker(Gameinfo.objects.last())
     assert liveticker.get_ticks() == []
Exemplo n.º 8
0
 def test_liveticker_get_time_when_gameStarted_empty(self):
     DBSetup().g62_status_empty()
     last_game = Gameinfo.objects.last()
     liveticker = Liveticker(last_game)
     assert liveticker.get_time() == '10:00'