コード例 #1
0
ファイル: test_repository.py プロジェクト: pombreda/pulp
    def test_distributor_delete_with_agent_errors(self, mock_dist_manager,
                                                  mock_bind_manager,
                                                  mock_unbind):
        mock_bind_manager.return_value.find_by_repo.return_value = [{
            'consumer_id':
            'foo',
            'repo_id':
            'repo-foo',
            'distributor_id':
            'dist-id'
        }]

        mock_bind_manager.return_value.find_by_distributor.return_value = [{
            'consumer_id':
            'foo',
            'repo_id':
            'repo-foo',
            'distributor_id':
            'dist-id'
        }]
        side_effect_exception = PulpException('foo')
        mock_unbind.side_effect = side_effect_exception

        result = repository.distributor_delete('foo-id', 'bar-id')

        mock_unbind.assert_called_once_with('foo', 'repo-foo', 'dist-id', ANY)
        self.assertTrue(isinstance(result.error, PulpException))
        self.assertEquals(result.error.error_code, error_codes.PLP0003)
        self.assertEquals(result.error.child_exceptions[0],
                          side_effect_exception)
コード例 #2
0
ファイル: test_repository.py プロジェクト: preethit/pulp-1
 def test_distributor_delete_with_bindings(self, mock_dist_manager, mock_bind_manager,
                                           mock_unbind):
     mock_bind_manager.return_value.find_by_distributor.return_value = [
         {'consumer_id': 'foo', 'repo_id': 'repo-foo', 'distributor_id': 'dist-id'}]
     mock_unbind.return_value = TaskResult(spawned_tasks=[{'task_id': 'foo-request-id'}])
     result = repository.distributor_delete('foo-id', 'bar-id')
     mock_dist_manager.return_value.remove_distributor.assert_called_with('foo-id', 'bar-id')
     mock_unbind.assert_called_once_with('foo', 'repo-foo', 'dist-id', ANY)
     self.assertEquals(result.spawned_tasks[0], {'task_id': 'foo-request-id'})
コード例 #3
0
ファイル: test_repository.py プロジェクト: preethit/pulp-1
    def test_distributor_delete_with_agent_errors(self, mock_dist_manager, mock_bind_manager,
                                                  mock_unbind):
        mock_bind_manager.return_value.find_by_repo.return_value = [
            {'consumer_id': 'foo', 'repo_id': 'repo-foo', 'distributor_id': 'dist-id'}]

        mock_bind_manager.return_value.find_by_distributor.return_value = [
            {'consumer_id': 'foo', 'repo_id': 'repo-foo', 'distributor_id': 'dist-id'}]
        side_effect_exception = PulpException('foo')
        mock_unbind.side_effect = side_effect_exception

        result = repository.distributor_delete('foo-id', 'bar-id')

        mock_unbind.assert_called_once_with('foo', 'repo-foo', 'dist-id', ANY)
        self.assertTrue(isinstance(result.error, PulpException))
        self.assertEquals(result.error.error_code, error_codes.PLP0003)
        self.assertEquals(result.error.child_exceptions[0], side_effect_exception)
コード例 #4
0
ファイル: test_repository.py プロジェクト: pombreda/pulp
 def test_distributor_delete_with_bindings(self, mock_dist_manager,
                                           mock_bind_manager, mock_unbind):
     mock_bind_manager.return_value.find_by_distributor.return_value = [{
         'consumer_id':
         'foo',
         'repo_id':
         'repo-foo',
         'distributor_id':
         'dist-id'
     }]
     mock_unbind.return_value = TaskResult(
         spawned_tasks=[{
             'task_id': 'foo-request-id'
         }])
     result = repository.distributor_delete('foo-id', 'bar-id')
     mock_dist_manager.return_value.remove_distributor.assert_called_with(
         'foo-id', 'bar-id')
     mock_unbind.assert_called_once_with('foo', 'repo-foo', 'dist-id', ANY)
     self.assertEquals(result.spawned_tasks[0],
                       {'task_id': 'foo-request-id'})
コード例 #5
0
ファイル: test_repository.py プロジェクト: preethit/pulp-1
 def test_distributor_delete_no_bindings(self, mock_dist_manager, mock_bind_manager):
     result = repository.distributor_delete('foo-id', 'bar-id')
     mock_dist_manager.return_value.remove_distributor.assert_called_with('foo-id', 'bar-id')
     self.assertTrue(isinstance(result, TaskResult))
コード例 #6
0
ファイル: test_repository.py プロジェクト: pombreda/pulp
 def test_distributor_delete_no_bindings(self, mock_dist_manager,
                                         mock_bind_manager):
     result = repository.distributor_delete('foo-id', 'bar-id')
     mock_dist_manager.return_value.remove_distributor.assert_called_with(
         'foo-id', 'bar-id')
     self.assertTrue(isinstance(result, TaskResult))