def test_download_sample_additional_extrafile_not_found( self, mock_extra, mock_sample, mock_serve_download): """Test function download_sample_additional to raise SampleNotFoundException when extra file not found.""" from mod_sample.controllers import (SampleNotFoundException, download_sample_additional) mock_extra.query.filter.return_value.first.return_value = None with self.assertRaises(SampleNotFoundException): download_sample_additional(1, 1) mock_sample.query.filter.assert_called_once_with(mock_sample.id == 1) mock_extra.query.filter.assert_called_once_with(mock_extra.id == 1)
def test_download_sample_additional(self, mock_extra, mock_sample, mock_serve_download): """Test function download_sample_additional.""" from mod_sample.controllers import download_sample_additional response = download_sample_additional(1, 1) self.assertEqual(response, mock_serve_download()) mock_sample.query.filter.assert_called_once_with(mock_sample.id == 1) mock_extra.query.filter.assert_called_once_with(mock_extra.id == 1)