Skip to content

Commit

Permalink
fixes json serialization error when adding catalog entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrivnak committed Jun 23, 2016
1 parent fd4d699 commit 70cd7e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions plugins/pulp_rpm/plugins/catalogers/yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from pulp.server.content.sources import descriptor

from pulp_rpm.common import ids
from pulp_rpm.plugins.db import models
from pulp_rpm.plugins.importers.yum.repomd.metadata import MetadataFiles
from pulp_rpm.plugins.importers.yum.repomd import primary, nectar_factory
from pulp_rpm.plugins.importers.yum.repomd import packages
Expand Down Expand Up @@ -51,7 +50,7 @@ def _add_packages(conduit, base_url, md_files):
for model in _packages:
unit_key = model.unit_key
url = urljoin(base_url, model.download_path)
conduit.add_entry(models.RPM._content_type_id, unit_key, url)
conduit.add_entry(model._content_type_id, unit_key, url)
finally:
fp.close()

Expand Down
13 changes: 13 additions & 0 deletions plugins/test/unit/plugins/catalogers/test_yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ def test_refresh(self, mock_add):
entry['unit_key'],
self._normalized(entry['url'])))

@patch('pulp.server.managers.content.catalog.ContentCatalogManager.add_entry')
def test_json_serializable(self, mock_add):
"""
ensure the arguments are json serializable
see https://pulp.plan.io/issues/2012
"""
url = 'file://%s/' % self.tmp_dir
conduit = CatalogerConduit(SOURCE_ID, EXPIRES)
cataloger = YumCataloger()
cataloger.refresh(conduit, {}, url)
for call in mock_add.call_args_list:
json.dumps(call)

@patch('pulp_rpm.plugins.catalogers.yum.descriptor')
def test_nectar_config(self, fake_descriptor):
config = Mock()
Expand Down

0 comments on commit 70cd7e4

Please sign in to comment.