|
47 | 47 | from warehouse.manage.views import organizations as org_views
|
48 | 48 | from warehouse.metrics.interfaces import IMetricsService
|
49 | 49 | from warehouse.oidc.interfaces import TooManyOIDCRegistrations
|
50 |
| -from warehouse.oidc.models import GitHubPublisher, OIDCPublisher |
| 50 | +from warehouse.oidc.models import GitHubPublisher, GooglePublisher, OIDCPublisher |
51 | 51 | from warehouse.organizations.interfaces import IOrganizationService
|
52 | 52 | from warehouse.organizations.models import (
|
53 | 53 | OrganizationRoleType,
|
@@ -5905,6 +5905,21 @@ def test_manage_project_oidc_publishers_admin_disabled(
|
5905 | 5905 | normalized_environment=publisher.environment,
|
5906 | 5906 | ),
|
5907 | 5907 | ),
|
| 5908 | + ( |
| 5909 | + "add_google_oidc_publisher", |
| 5910 | + pretend.stub( |
| 5911 | + id="fakeid", |
| 5912 | + publisher_name="Google", |
| 5913 | + publisher_url=lambda x=None: None, |
| 5914 | + |
| 5915 | + sub="some-sub", |
| 5916 | + ), |
| 5917 | + lambda publisher: pretend.stub( |
| 5918 | + validate=pretend.call_recorder(lambda: True), |
| 5919 | + email=pretend.stub(data=publisher.email), |
| 5920 | + sub=pretend.stub(data=publisher.sub), |
| 5921 | + ), |
| 5922 | + ), |
5908 | 5923 | ],
|
5909 | 5924 | )
|
5910 | 5925 | def test_add_oidc_publisher_preexisting(
|
@@ -6014,6 +6029,15 @@ def test_add_oidc_publisher_preexisting(
|
6014 | 6029 | ),
|
6015 | 6030 | pretend.stub(publisher_name="GitHub"),
|
6016 | 6031 | ),
|
| 6032 | + ( |
| 6033 | + "add_google_oidc_publisher", |
| 6034 | + pretend.stub( |
| 6035 | + validate=pretend.call_recorder(lambda: True), |
| 6036 | + email=pretend.stub(data="[email protected]"), |
| 6037 | + sub=pretend.stub(data="some-sub"), |
| 6038 | + ), |
| 6039 | + "Google", |
| 6040 | + ), |
6017 | 6041 | ],
|
6018 | 6042 | )
|
6019 | 6043 | def test_add_oidc_publisher_created(
|
@@ -6143,6 +6167,20 @@ def test_add_oidc_publisher_created(
|
6143 | 6167 | }
|
6144 | 6168 | ),
|
6145 | 6169 | ),
|
| 6170 | + ( |
| 6171 | + "add_google_oidc_publisher", |
| 6172 | + "Google", |
| 6173 | + GooglePublisher( |
| 6174 | + |
| 6175 | + sub="some-sub", |
| 6176 | + ), |
| 6177 | + MultiDict( |
| 6178 | + { |
| 6179 | + |
| 6180 | + "sub": "some-sub", |
| 6181 | + } |
| 6182 | + ), |
| 6183 | + ), |
6146 | 6184 | ],
|
6147 | 6185 | )
|
6148 | 6186 | def test_add_oidc_publisher_already_registered_with_project(
|
@@ -6209,6 +6247,7 @@ def test_add_oidc_publisher_already_registered_with_project(
|
6209 | 6247 | "view_name, publisher_name",
|
6210 | 6248 | [
|
6211 | 6249 | ("add_github_oidc_publisher", "GitHub"),
|
| 6250 | + ("add_google_oidc_publisher", "Google"), |
6212 | 6251 | ],
|
6213 | 6252 | )
|
6214 | 6253 | def test_add_oidc_publisher_ratelimited(
|
@@ -6256,6 +6295,7 @@ def test_add_oidc_publisher_ratelimited(
|
6256 | 6295 | "view_name, publisher_name",
|
6257 | 6296 | [
|
6258 | 6297 | ("add_github_oidc_publisher", "GitHub"),
|
| 6298 | + ("add_google_oidc_publisher", "Google"), |
6259 | 6299 | ],
|
6260 | 6300 | )
|
6261 | 6301 | def test_add_oidc_publisher_admin_disabled(
|
@@ -6296,6 +6336,7 @@ def test_add_oidc_publisher_admin_disabled(
|
6296 | 6336 | "view_name, publisher_name",
|
6297 | 6337 | [
|
6298 | 6338 | ("add_github_oidc_publisher", "GitHub"),
|
| 6339 | + ("add_google_oidc_publisher", "Google"), |
6299 | 6340 | ],
|
6300 | 6341 | )
|
6301 | 6342 | def test_add_oidc_publisher_invalid_form(
|
@@ -6357,6 +6398,10 @@ def test_add_oidc_publisher_invalid_form(
|
6357 | 6398 | workflow_filename="some-workflow-filename.yml",
|
6358 | 6399 | environment="some-environment",
|
6359 | 6400 | ),
|
| 6401 | + GooglePublisher( |
| 6402 | + |
| 6403 | + sub="some-sub", |
| 6404 | + ), |
6360 | 6405 | ],
|
6361 | 6406 | )
|
6362 | 6407 | def test_delete_oidc_publisher_registered_to_multiple_projects(
|
@@ -6455,6 +6500,10 @@ def test_delete_oidc_publisher_registered_to_multiple_projects(
|
6455 | 6500 | workflow_filename="some-workflow-filename.yml",
|
6456 | 6501 | environment="some-environment",
|
6457 | 6502 | ),
|
| 6503 | + GooglePublisher( |
| 6504 | + |
| 6505 | + sub="some-sub", |
| 6506 | + ), |
6458 | 6507 | ],
|
6459 | 6508 | )
|
6460 | 6509 | def test_delete_oidc_publisher_entirely(self, monkeypatch, db_request, publisher):
|
|
0 commit comments