Skip to content

Commit

Permalink
adding tests for publisher_base_url
Browse files Browse the repository at this point in the history
Signed-off-by: Javan lacerda <javanlacerda@google.com>
  • Loading branch information
javanlacerda committed May 6, 2024
1 parent 662fb87 commit 4fe5275
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/unit/oidc/models/test_activestate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/unit/oidc/models/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
1 change: 1 addition & 0 deletions tests/unit/oidc/models/test_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/oidc/models/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 4fe5275

Please sign in to comment.