class TestRepositoryDistributorAPI(unittest.TestCase): """ Tests for the RepositoryDistributorAPI. """ def setUp(self): self.api = RepositoryDistributorAPI( mock.MagicMock(spec=PulpConnection)) def test_update(self): # Setup expected_path = self.api.base_path % 'test-repo' + 'test-distributor/' expected_body = { 'distributor_config': { 'key': 'value' }, 'delta': { 'auto_publish': True } } # Test result = self.api.update('test-repo', 'test-distributor', {'key': 'value'}, {'auto_publish': True}) self.api.server.PUT.assert_called_once_with(expected_path, expected_body) self.assertEqual(result, self.api.server.PUT.return_value)
class TestRepositoryDistributorAPI(unittest.TestCase): """ Tests for the RepositoryDistributorAPI. """ def setUp(self): self.api = RepositoryDistributorAPI(mock.MagicMock(spec=PulpConnection)) def test_update(self): # Setup expected_path = self.api.base_path % 'test-repo' + 'test-distributor/' expected_body = {'distributor_config': {'key': 'value'}, 'delta': {'auto_publish': True}} # Test result = self.api.update('test-repo', 'test-distributor', {'key': 'value'}, {'auto_publish': True}) self.api.server.PUT.assert_called_once_with(expected_path, expected_body) self.assertEqual(result, self.api.server.PUT.return_value)