From 4fe527587cb0f867ab60c08fcc1b49738fe902ae Mon Sep 17 00:00:00 2001 From: Javan lacerda Date: Mon, 6 May 2024 14:54:14 +0000 Subject: [PATCH] adding tests for publisher_base_url Signed-off-by: Javan lacerda --- tests/unit/oidc/models/test_activestate.py | 12 ++++++++++++ tests/unit/oidc/models/test_github.py | 1 + tests/unit/oidc/models/test_gitlab.py | 1 + tests/unit/oidc/models/test_google.py | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/tests/unit/oidc/models/test_activestate.py b/tests/unit/oidc/models/test_activestate.py index f03e23fdf20f..b5541db869e3 100644 --- a/tests/unit/oidc/models/test_activestate.py +++ b/tests/unit/oidc/models/test_activestate.py @@ -84,6 +84,18 @@ def test_publisher_name(self): assert publisher.publisher_name == "ActiveState" + def test_publisher_base_url(self): + org_name = "fakeorg" + project_name = "fakeproject" + publisher = ActiveStatePublisher( + organization=org_name, activestate_project_name=project_name + ) + + assert ( + publisher.publisher_base_url + == f"https://platform.activestate.com/{org_name}/{project_name}" + ) + def test_publisher_url(self): org_name = "fakeorg" project_name = "fakeproject" diff --git a/tests/unit/oidc/models/test_github.py b/tests/unit/oidc/models/test_github.py index a0bf7826dfec..2130309c4253 100644 --- a/tests/unit/oidc/models/test_github.py +++ b/tests/unit/oidc/models/test_github.py @@ -96,6 +96,7 @@ def test_github_publisher_computed_properties(self): assert getattr(publisher, claim_name) is not None assert str(publisher) == "fakeworkflow.yml" + assert publisher.publisher_base_url == "https://github.com/fakeowner/fakerepo" assert publisher.publisher_url() == "https://github.com/fakeowner/fakerepo" assert ( publisher.publisher_url({"sha": "somesha"}) diff --git a/tests/unit/oidc/models/test_gitlab.py b/tests/unit/oidc/models/test_gitlab.py index fa0ac48b3fc8..4e63392f472d 100644 --- a/tests/unit/oidc/models/test_gitlab.py +++ b/tests/unit/oidc/models/test_gitlab.py @@ -94,6 +94,7 @@ def test_gitlab_publisher_computed_properties(self): assert getattr(publisher, claim_name) is not None assert str(publisher) == "subfolder/fakeworkflow.yml" + assert publisher.publisher_base_url == "https://gitlab.com/fakeowner/fakerepo" assert publisher.publisher_url() == "https://gitlab.com/fakeowner/fakerepo" assert ( publisher.publisher_url({"sha": "somesha"}) diff --git a/tests/unit/oidc/models/test_google.py b/tests/unit/oidc/models/test_google.py index d0ce98e689d3..88935aca255a 100644 --- a/tests/unit/oidc/models/test_google.py +++ b/tests/unit/oidc/models/test_google.py @@ -33,6 +33,11 @@ def test_publisher_name(self): assert publisher.publisher_name == "Google" + def test_publisher_base_url(self): + publisher = google.GooglePublisher(email="fake@example.com") + + assert publisher.publisher_base_url is None + def test_publisher_url(self): publisher = google.GooglePublisher(email="fake@example.com")