Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pulp_npm/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def _npm_repository_factory(remote=None, pulp_domain=None, **body):
kwargs = {}
if pulp_domain:
kwargs["pulp_domain"] = pulp_domain
if remote:
body["remote"] = remote if isinstance(remote, str) else remote.pulp_href
return gen_object_with_cleanup(npm_bindings.RepositoriesNpmApi, body, **kwargs)

return _npm_repository_factory
Expand Down
15 changes: 4 additions & 11 deletions pulp_npm/tests/functional/api/test_sync.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding=utf-8
"""Tests that sync npm plugin repositories."""
import pytest
import uuid

from pulpcore.client.pulp_npm import RepositorySyncURL

Expand All @@ -14,21 +13,15 @@

@pytest.mark.parallel
def test_sync_endpoint_demanding_remote_payload(
npm_bindings, gen_object_with_cleanup, monitor_task
npm_bindings, npm_remote_factory, npm_repository_factory, monitor_task
):
remote = gen_object_with_cleanup(
npm_bindings.RemotesNpmApi,
{"name": str(uuid.uuid4()), "url": "https://registry.npmjs.org/commander/4.0.1"},
)
repository = gen_object_with_cleanup(
npm_bindings.RepositoriesNpmApi, {"name": str(uuid.uuid4()), "remote": remote.pulp_href}
)
remote = npm_remote_factory(url="https://registry.npmjs.org/commander/4.0.1")
repository = npm_repository_factory(remote=remote.pulp_href)

versions = npm_bindings.RepositoriesNpmVersionsApi.list(repository.pulp_href)
assert versions.count == 1

sync_url = RepositorySyncURL()
monitor_task(npm_bindings.RepositoriesNpmApi.sync(repository.pulp_href, sync_url).task)
monitor_task(npm_bindings.RepositoriesNpmApi.sync(repository.pulp_href, {}).task)

new_versions = npm_bindings.RepositoriesNpmVersionsApi.list(repository.pulp_href)
assert new_versions.count > 1
Expand Down