Exemplo n.º 1
0
 def test_get_as_json(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(TeamLog.objects.filter(event='Touchdown').first(), 'home')
     teamlog_entry: TeamLog = TeamLog.objects.first()
     expected_time = teamlog_entry.created_time.strftime("%H:%M")
     assert tick.as_json() == {
         "text": "Touchdown: #19",
         "team": 'home',
         "time": expected_time,
     }
Exemplo n.º 2
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.º 3
0
 def test_get_text_for_turnover(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(TeamLog.objects.filter(event='Turnover').first(), False)
     assert tick.get_text() == 'Ballabgabe'
Exemplo n.º 4
0
 def test_get_text_for_safety(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(TeamLog.objects.filter(event='Safety').first(), False)
     assert tick.get_text() == 'Safety: #7'
Exemplo n.º 5
0
 def test_get_text_for_incomplete_pat(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(
         TeamLog.objects.filter(event='1-Extra-Punkt', player=None).first(),
         False)
     assert tick.get_text() == '1-Extra-Punkt: -'
Exemplo n.º 6
0
 def test_get_text_for_game_time(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(TeamLog.objects.filter(event='Spielzeit').first(), False)
     assert tick.get_text() == 'Spielzeit - 12:10'
Exemplo n.º 7
0
 def test_get_text_for_timeout(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(TeamLog.objects.filter(event='Auszeit').first(), False)
     assert tick.get_text() == 'Auszeit - 00:01'
Exemplo n.º 8
0
 def test_get_text_for_touchdown(self):
     DBSetup().create_teamlog_home_and_away()
     tick = Tick(TeamLog.objects.all()[1], 'home')
     assert tick.get_text() == 'Touchdown: #19'
Exemplo n.º 9
0
 def test_get_time(self):
     DBSetup().create_teamlog_home_and_away()
     teamlog_entry: TeamLog = TeamLog.objects.first()
     expected_time = teamlog_entry.created_time.strftime("%H:%M")
     tick = Tick(teamlog_entry, False)
     assert tick.get_time() == expected_time