コード例 #1
0
ファイル: test_model.py プロジェクト: mbryantlibrary/BatCoach
    def test_import_file_calls_parse_players_if_squad_file(self, mock_parse_team_id, mock_add, mock_first, mock_count, mock_parse_players):
        """ Tests that parse_players is called if the HTML file is a Squad file """
        html_file = HTMLFile()
        html_file.type = PageTypes.Squad.value
        html_file.HTML = 'some HTML'

        mock_parse_players.return_value = []
        mock_parse_team_id.return_value = 3000

        team = Team()
        mock_first.result = team

        self.model.import_file(html_file)
        mock_parse_players.assert_called_with(html_file.HTML)
コード例 #2
0
ファイル: test_model.py プロジェクト: mbryantlibrary/BatCoach
    def test_import_file_calls_parse_pavilion_if_pavilion_file(self, mock_ranking,mock_parse_team_id, mock_first, mock_parse_pavilion):
        html_file = HTMLFile()
        html_file.type = PageTypes.Pavilion.value
        html_file.HTML = 'some HTML'
        

        mock_parse_pavilion.return_value = []
        mock_parse_team_id.return_value = 3000

        team = Team()
        team.rankings.append = mock.Mock()

        mock_first.result = team
        self.model.import_file(html_file)

        assert mock_parse_team_id.called