Пример #1
0
    def test_scheduler_does_not_send_highlight_when_date_too_old(self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(
                id=9,
                team1='Swansea',
                score1=0,
                team2='Barcelona',
                score2=3,
                competition='Champions League',
            ), messages)
Пример #2
0
    def test_scheduler_does_not_send_highlight_with_incomplete_data(self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(
                id=9,
                team1='Marseille',
                score1=-1,
                team2='Monaco',
                score2=-1,
                competition='Ligue 1',
            ), messages)
Пример #3
0
    def test_scheduler_does_not_send_highlight_message_for_subscribed_team_when_too_recent(
            self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(
                id=6,
                team1='Barcelona',
                score1=1,
                team2='Liverpool',
                score2=1,
                competition='Champions League',
            ), messages)
Пример #4
0
    def test_highlights_blocked_when_competition_flagged_in_blocked_notification(
            self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(
                id=16,
                team1='France',
                score1=2,
                team2='England',
                score2=0,
                competition='Nations League',
            ), messages)
Пример #5
0
    def test_scheduler_does_not_send_highlight_if_highlight_inverted_home_and_away_teams(
            self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(
                id=9,
                team1='Barcelona',
                score1=2,
                team2='Chelsea',
                score2=0,
                competition='Champions League',
            ), messages)
Пример #6
0
    def test_scheduler_does_not_send_highlight_when_no_goals_info_before_30_minutes(
            self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(id=19,
                                                team1='Belgium',
                                                score1=1,
                                                team2='Liverpool',
                                                score2=0,
                                                competition='Nations League',
                                                img_link=TEST_UPLOADED_IMAGE),
            messages)
Пример #7
0
    def test_scheduler_does_not_send_highlights_straight_if_goals_scored_in_last_minutes_of_match(
            self):
        # Given

        # When
        self.send_most_recent_highlights()

        # Then
        messages = [json.loads(m) for m in sender.CLIENT.messages]

        assert_highlight_not_in(
            create_formatted_highlight_response(id=18,
                                                team1='Liverpool',
                                                score1=1,
                                                team2='France',
                                                score2=0,
                                                competition='Nations League',
                                                img_link=TEST_UPLOADED_IMAGE),
            messages)