def test_api_props_output_file(self, mock_url, mock_creds, mock_config, mock_head): """Test props_output_file""" _api = BatchAppsApi(mock_creds, mock_config) mock_url.return_value = "https://test.com/{jobid}/{name}" mock_head.return_value = 0 val = _api.props_output_file() self.assertFalse(val.success) self.assertFalse(mock_head.called) val = _api.props_output_file(job_id="test_abc") self.assertFalse(val.success) self.assertFalse(mock_head.called) val = _api.props_output_file(job_id="test_abc", fname="file.zip") mock_head.assert_called_with(mock_creds, "https://test.com/test_abc/file.zip", self.headers) self.assertTrue(mock_url.called) val = _api.props_output_file(job_id="test_abc", fname="file.zip", url="http://test") mock_head.assert_called_with(mock_creds, "https://test.com/test_abc/file.zip", self.headers) self.assertTrue(val.success) val = _api.props_output_file(url="http://test") mock_head.assert_called_with(mock_creds, "http://test", self.headers) self.assertTrue(val.success) mock_head.side_effect = RestCallException(None, "Boom!", None) val = _api.props_output_file(url="http://test") self.assertFalse(val.success)