Ejemplo n.º 1
0
    def test_download_result_file_not_found(self, mock_regression_output):
        """Test that non-existent result file gives 404."""
        from mod_regression.controllers import test_result_file
        mock_regression_output.query.filter.return_value.first.return_value = None

        with self.assertRaises(NotFound):
            test_result_file(1)

        mock_regression_output.query.filter.assert_called_once_with(
            mock_regression_output.id == 1)
Ejemplo n.º 2
0
    def test_download_result_file(self, mock_regression_output, mock_serve):
        """Test that correct result file triggers serve download."""
        from mod_regression.controllers import test_result_file

        response = test_result_file(1)

        mock_regression_output.query.filter.assert_called_once_with(
            mock_regression_output.id == 1)
        mock_serve.assert_called_once()