def test_download_pipeline(self, mock_open, mock_get, version, tag, file_name, expected_url, expected_file_name): mock_open.reset_mock() host = _DEFAULT_HOST client = RegistryClient(host=host, auth=ApiAuth('')) client.download_pipeline(package_name='pack', version=version, tag=tag, file_name=file_name) mock_get.assert_called_once_with(url=expected_url, data='', headers=None, auth=mock.ANY) mock_open.assert_called_once_with(expected_file_name, 'wb')
def test_download_pipeline_tag_error(self): client = RegistryClient(host=_DEFAULT_HOST, auth=ApiAuth('')) with self.assertRaises(ValueError): client.download_pipeline(package_name='pack', tag='sha256:abcde12345')