Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the missing REMOTE_TYPES property of NpmRepository class. #279

Merged
merged 1 commit into from
Feb 11, 2025
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
1 change: 1 addition & 0 deletions CHANGES/276.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes the missing REMOTE_TYPES property of the NpmRepository class.
1 change: 1 addition & 0 deletions pulp_npm/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions pulp_npm/tests/functional/api/test_crud_content_unit.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
18 changes: 18 additions & 0 deletions pulp_npm/tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ classifiers=[
]
requires-python = ">=3.6"
dependencies = [
"pulpcore>=3.28.15,<3.70",
"pulpcore>=3.44,<3.70",
]

[project.urls]
Expand Down Expand Up @@ -127,4 +127,4 @@ replace = "version = \"{new_version}\""

filename = "./pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""
replace = "version = \"{new_version}\""