diff --git a/CHANGES/276.bugfix b/CHANGES/276.bugfix new file mode 100644 index 0000000..9525753 --- /dev/null +++ b/CHANGES/276.bugfix @@ -0,0 +1 @@ +Fixes the missing REMOTE_TYPES property of the NpmRepository class. diff --git a/pulp_npm/app/models.py b/pulp_npm/app/models.py index c5b88cc..b68dd33 100644 --- a/pulp_npm/app/models.py +++ b/pulp_npm/app/models.py @@ -78,6 +78,7 @@ class NpmRepository(Repository): TYPE = "npm" CONTENT_TYPES = [Package] + REMOTE_TYPES = [NpmRemote] class Meta: default_related_name = "%(app_label)s_%(model_name)s" diff --git a/pulp_npm/tests/functional/api/test_crud_content_unit.py b/pulp_npm/tests/functional/api/test_crud_content_unit.py index dbe17a3..4514afd 100644 --- a/pulp_npm/tests/functional/api/test_crud_content_unit.py +++ b/pulp_npm/tests/functional/api/test_crud_content_unit.py @@ -1,6 +1,8 @@ # coding=utf-8 """Tests that perform actions over content unit.""" +import pytest import unittest +import uuid from requests.exceptions import HTTPError @@ -101,3 +103,13 @@ def test_04_delete(self): with self.assertRaises(HTTPError) as exc: self.client.delete(self.content_unit["pulp_href"]) self.assertEqual(exc.exception.response.status_code, 405) + + +@pytest.mark.parallel +def test_repository_creation_with_remote(npm_bindings): + remote = npm_bindings.RemotesNpmApi.create({"name": str(uuid.uuid4()), "url": "http://npm"}) + repository = npm_bindings.RepositoriesNpmApi.create( + {"name": str(uuid.uuid4()), "remote": remote.pulp_href} + ) + + assert repository.remote == remote.pulp_href diff --git a/pulp_npm/tests/functional/conftest.py b/pulp_npm/tests/functional/conftest.py new file mode 100644 index 0000000..2bb5e8f --- /dev/null +++ b/pulp_npm/tests/functional/conftest.py @@ -0,0 +1,18 @@ +import pytest + +from pulpcore.tests.functional.utils import BindingsNamespace + + +@pytest.fixture(scope="session") +def npm_bindings(_api_client_set, bindings_cfg): + """ + A namespace providing preconfigured pulp_npm api clients. + + e.g. `npm.RepositoriesNpmApi.list()`. + """ + from pulpcore.client import pulp_npm as npm_bindings_module + + api_client = npm_bindings_module.ApiClient(bindings_cfg) + _api_client_set.add(api_client) + yield BindingsNamespace(npm_bindings_module, api_client) + _api_client_set.remove(api_client) diff --git a/pyproject.toml b/pyproject.toml index 2d6f181..0afd1d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers=[ ] requires-python = ">=3.6" dependencies = [ - "pulpcore>=3.28.15,<3.70", + "pulpcore>=3.44,<3.70", ] [project.urls] @@ -127,4 +127,4 @@ replace = "version = \"{new_version}\"" filename = "./pyproject.toml" search = "version = \"{current_version}\"" -replace = "version = \"{new_version}\"" \ No newline at end of file +replace = "version = \"{new_version}\""