Skip to content

Commit a878a8a

Browse files
committed
adding tests for publisher_base_url
Signed-off-by: Javan lacerda <[email protected]>
1 parent 662fb87 commit a878a8a

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

tests/unit/oidc/models/test_activestate.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ def test_publisher_name(self):
8484

8585
assert publisher.publisher_name == "ActiveState"
8686

87+
def test_publisher_base_url(self):
88+
org_name = "fakeorg"
89+
project_name = "fakeproject"
90+
publisher = ActiveStatePublisher(
91+
organization=org_name, activestate_project_name=project_name
92+
)
93+
94+
assert (
95+
publisher.publisher_base_url
96+
== f"https://platform.activestate.com/{org_name}/{project_name}"
97+
)
98+
8799
def test_publisher_url(self):
88100
org_name = "fakeorg"
89101
project_name = "fakeproject"

tests/unit/oidc/models/test_github.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def test_github_publisher_computed_properties(self):
9696
assert getattr(publisher, claim_name) is not None
9797

9898
assert str(publisher) == "fakeworkflow.yml"
99+
assert publisher.publisher_base_url == "https://github.com/fakeowner/fakerepo"
99100
assert publisher.publisher_url() == "https://github.com/fakeowner/fakerepo"
100101
assert (
101102
publisher.publisher_url({"sha": "somesha"})

tests/unit/oidc/models/test_gitlab.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def test_gitlab_publisher_computed_properties(self):
9494
assert getattr(publisher, claim_name) is not None
9595

9696
assert str(publisher) == "subfolder/fakeworkflow.yml"
97+
assert publisher.publisher_base_url == "https://gitlab.com/fakeowner/fakerepo"
9798
assert publisher.publisher_url() == "https://gitlab.com/fakeowner/fakerepo"
9899
assert (
99100
publisher.publisher_url({"sha": "somesha"})

tests/unit/oidc/models/test_google.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ def test_publisher_name(self):
3333

3434
assert publisher.publisher_name == "Google"
3535

36+
37+
def test_publisher_base_url(self):
38+
publisher = google.GooglePublisher(email="[email protected]")
39+
40+
assert publisher.publisher_base_url is None
41+
3642
def test_publisher_url(self):
3743
publisher = google.GooglePublisher(email="[email protected]")
3844

0 commit comments

Comments
 (0)