Skip to content

Commit 3ba4971

Browse files
Update unitb test to use Github URL
1 parent 1b98ea3 commit 3ba4971

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎.env.example‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ PYTEST_CLOUDSMITH_API_KEY=
55
PYTEST_CLOUDSMITH_ORGANIZATION=
66
PYTEST_CLOUDSMITH_PASSWORD=
77
PYTEST_CLOUDSMITH_USERNAME=
8+
PYTEST_GITHUB_TOKEN=

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ jobs:
128128
PYTEST_CLOUDSMITH_ORGANIZATION: ${{ vars.PYTEST_CLOUDSMITH_ORGANIZATION }}
129129
PYTEST_CLOUDSMITH_USERNAME: ${{ secrets.PYTEST_CLOUDSMITH_USERNAME }}
130130
PYTEST_CLOUDSMITH_PASSWORD: ${{ secrets.PYTEST_CLOUDSMITH_PASSWORD }}
131+
PYTEST_GITHUB_TOKEN: ${{ secrets.PYTEST_GITHUB_TOKEN }}
131132
run: uv run pytest -m integration --junitxml=./reports/pytest.xml
132133

133134
- name: Upload test results

‎cloudsmith_cli/cli/tests/commands/test_upstream.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ..utils import random_str
77

88
#: The canonical public upstream for each format. These are already indexed,
9-
#: so the API validates them quickly, and none needs credentials. The API
9+
#: so the API validates them quickly, and only skills (GitHub) takes a token. The API
1010
#: strips trailing slashes, so none is written with one. Formats without a
1111
#: single canonical source (generic, swift) use a small placeholder page.
1212
UPSTREAM_URLS = {
@@ -29,7 +29,7 @@
2929
"python": "https://pypi.org",
3030
"rpm": "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/35/Everything/x86_64/os",
3131
"ruby": "https://rubygems.org",
32-
"skills": "https://clawhub.ai",
32+
"skills": "https://github.com/anthropics/claude-plugins-official",
3333
"swift": "https://example.org",
3434
}
3535

@@ -52,7 +52,7 @@ def assert_succeeded(result):
5252
@pytest.mark.integration
5353
@pytest.mark.parametrize("upstream_format", UPSTREAM_FORMATS)
5454
def test_upstream_commands(
55-
runner, organization, upstream_format, tmp_repository, tmp_path
55+
request, runner, organization, upstream_format, tmp_repository, tmp_path
5656
):
5757
upstream_config = {
5858
# "name" and "upstream_url" are the only required properties for most formats.
@@ -66,8 +66,12 @@ def test_upstream_commands(
6666

6767
# Skills specific arguments
6868
if upstream_format == "skills":
69-
upstream_config["contents"] = "Skills"
69+
# This GitHub host only offers skills and plugins together.
70+
upstream_config["contents"] = "Skills and plugins"
7071
upstream_config["mode"] = "Cache and Proxy"
72+
# Requested here rather than as a parameter so only skills skips without it.
73+
upstream_config["auth_mode"] = "Token"
74+
upstream_config["auth_secret"] = request.getfixturevalue("github_token")
7175

7276
upstream_config_file = tmp_path / (f"cli-test-upstream-{upstream_format}.json")
7377
upstream_config_file.write_text(str(json.dumps(upstream_config)))

‎cloudsmith_cli/cli/tests/conftest.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def api_key():
5353
return _get_env_var_or_skip("PYTEST_CLOUDSMITH_API_KEY")
5454

5555

56+
@pytest.fixture()
57+
def github_token():
58+
"""Return the PYTEST_GITHUB_TOKEN value."""
59+
return _get_env_var_or_skip("PYTEST_GITHUB_TOKEN")
60+
61+
5662
@pytest.fixture()
5763
def organization():
5864
"""Return the PYTEST_CLOUDSMITH_ORGANIZATION value.

0 commit comments

Comments
 (0)