def test_already_available_elsewhere(self): client, owner, channel = [ mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel ] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') config = self._get_config() source_owner = 'fake_owner' # The osx-64 subdirectory at the end of the URL is not important to the test. for url in [ 'http://foo.bar/{}/osx-64/'.format(source_owner), 'https://foo.bar/wibble/{}/osx-64/'.format(source_owner), 'https://foo.bar/wibble/{}/osx-64'.format(source_owner) ]: with self.dist_exists_setup(on_owner=False, on_channel=False): with mock.patch( 'conda_build_all.inspect_binstar.copy_distribution_to_owner' ) as copy: ad.make_available(meta, url, just_built=False, config=config) copy.assert_called_once_with(ad._cli, source_owner, owner, meta, channel=channel)
def test_already_available_elsewhere(self): client, owner, channel = [mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=False, on_channel=False): with self.assertRaises(NotImplementedError): ad.make_available(meta, mock.sentinel.dist_path, just_built=False)
def test_already_available_just_built(self): client, owner, channel = [mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=True, on_channel=True): ad.make_available(meta, mock.sentinel.dist_path, just_built=True) # Nothing happens, we just get a message. self.logger.warn.assert_called_once_with("Assuming the distribution we've just built and the one on sentinel.owner/sentinel.channel are the same.")
def test_already_available_elsewhere(self): client, owner, channel = [ mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel ] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') for url in ['http://foo.bar/', 'https://foo.bar/wibble']: with self.dist_exists_setup(on_owner=False, on_channel=False): with self.assertRaises(NotImplementedError): ad.make_available(meta, url, just_built=False)
def test_not_already_available_just_built(self): client, owner, channel = [mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=False, on_channel=False): with mock.patch('conda_build_all.build.upload') as upload: ad.make_available(meta, mock.sentinel.dist_path, just_built=True) upload.assert_called_once_with(client, meta, owner, channels=[channel]) self.logger.info.assert_called_once_with('Uploading a to the sentinel.channel channel.')
def test_not_already_available_not_just_built(self): client, owner, channel = [mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=True, on_channel=False): with mock.patch('conda_build_all.inspect_binstar.add_distribution_to_channel') as add_to_channel: ad.make_available(meta, mock.sentinel.dist_path, just_built=False) add_to_channel.assert_called_once_with(client, owner, meta, channel=channel) self.logger.info.assert_called_once_with('Adding existing a-0.0-0 to the sentinel.owner/sentinel.channel channel.')
def test_already_available_just_built(self): client, owner, channel = [ mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel ] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=True, on_channel=True): ad.make_available(meta, mock.sentinel.dist_path, just_built=True) # Nothing happens, we just get a message. self.logger.warn.assert_called_once_with( "Assuming the distribution we've just built and the one on sentinel.owner/sentinel.channel are the same." )
def test_already_available_not_just_built(self): # Note, we exercise the use of get_binstar here too. client, owner, channel = [mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=True, on_channel=True): with mock.patch('binstar_client.utils.get_binstar') as get_binstar: ad.make_available(meta, mock.sentinel.dist_path, just_built=False) get_binstar.assert_called_once_with(Namespace(site=None, token=mock.sentinel.token)) # Nothing happens, we just get a message. self.logger.info.assert_called_once_with('Nothing to be done for a - it is already on sentinel.owner/sentinel.channel.')
def test_not_already_available_just_built(self): client, owner, channel = [ mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel ] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=False, on_channel=False): with mock.patch('conda_build_all.build.upload') as upload: ad.make_available(meta, mock.sentinel.dist_path, just_built=True) upload.assert_called_once_with(client, meta, owner, channels=[channel]) self.logger.info.assert_called_once_with( 'Uploading a to the sentinel.channel channel.')
def test_already_available_elsewhere(self): client, owner, channel = [mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') source_owner = 'fake_owner' # The osx-64 subdirectory at the end of the URL is not important to the test. for url in ['http://foo.bar/{}/osx-64/'.format(source_owner), 'https://foo.bar/wibble/{}/osx-64/'.format(source_owner), 'https://foo.bar/wibble/{}/osx-64'.format(source_owner)]: with self.dist_exists_setup(on_owner=False, on_channel=False): with mock.patch('conda_build_all.inspect_binstar.copy_distribution_to_owner') as copy: ad.make_available(meta, url, just_built=False) copy.assert_called_once_with(ad._cli, source_owner, owner, meta, channel=channel)
def test_already_available_not_just_built(self): # Note, we exercise the use of get_binstar here too. client, owner, channel = [ mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel ] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=True, on_channel=True): with mock.patch('binstar_client.utils.get_binstar') as get_binstar: ad.make_available(meta, mock.sentinel.dist_path, just_built=False) get_binstar.assert_called_once_with( Namespace(site=None, token=mock.sentinel.token)) # Nothing happens, we just get a message. self.logger.info.assert_called_once_with( 'Nothing to be done for a - it is already on sentinel.owner/sentinel.channel.' )
def test_not_already_available_not_just_built(self): client, owner, channel = [ mock.sentinel.client, mock.sentinel.owner, mock.sentinel.channel ] ad = AnacondaClientChannelDest(mock.sentinel.token, owner, channel) ad._cli = client meta = DummyPackage('a', '2.1.0') with self.dist_exists_setup(on_owner=True, on_channel=False): with mock.patch( 'conda_build_all.inspect_binstar.add_distribution_to_channel' ) as add_to_channel: ad.make_available(meta, mock.sentinel.dist_path, just_built=False) add_to_channel.assert_called_once_with(client, owner, meta, channel=channel) self.logger.info.assert_called_once_with( 'Adding existing a-0.0-0 to the sentinel.owner/sentinel.channel channel.' )