|
57 | 57 | from warehouse.events.tags import EventTag
|
58 | 58 | from warehouse.metrics.interfaces import IMetricsService
|
59 | 59 | from warehouse.oidc.interfaces import TooManyOIDCRegistrations
|
60 |
| -from warehouse.oidc.models import PendingGitHubPublisher |
| 60 | +from warehouse.oidc.models import PendingGitHubPublisher, PendingGooglePublisher |
61 | 61 | from warehouse.organizations.models import (
|
62 | 62 | OrganizationInvitation,
|
63 | 63 | OrganizationRole,
|
@@ -3431,6 +3431,11 @@ def test_manage_publishing_admin_disabled(self, monkeypatch, pyramid_request):
|
3431 | 3431 | AdminFlagValue.DISALLOW_GITHUB_OIDC,
|
3432 | 3432 | "GitHub",
|
3433 | 3433 | ),
|
| 3434 | + ( |
| 3435 | + "add_pending_google_oidc_publisher", |
| 3436 | + AdminFlagValue.DISALLOW_GOOGLE_OIDC, |
| 3437 | + "Google", |
| 3438 | + ), |
3434 | 3439 | ],
|
3435 | 3440 | )
|
3436 | 3441 | def test_add_pending_oidc_publisher_admin_disabled(
|
@@ -3502,6 +3507,11 @@ def test_add_pending_oidc_publisher_admin_disabled(
|
3502 | 3507 | AdminFlagValue.DISALLOW_GITHUB_OIDC,
|
3503 | 3508 | "GitHub",
|
3504 | 3509 | ),
|
| 3510 | + ( |
| 3511 | + "add_pending_google_oidc_publisher", |
| 3512 | + AdminFlagValue.DISALLOW_GOOGLE_OIDC, |
| 3513 | + "Google", |
| 3514 | + ), |
3505 | 3515 | ],
|
3506 | 3516 | )
|
3507 | 3517 | def test_add_pending_oidc_publisher_user_cannot_register(
|
@@ -3596,6 +3606,18 @@ def test_add_pending_oidc_publisher_user_cannot_register(
|
3596 | 3606 | ),
|
3597 | 3607 | PendingGitHubPublisher,
|
3598 | 3608 | ),
|
| 3609 | + ( |
| 3610 | + "add_pending_google_oidc_publisher", |
| 3611 | + AdminFlagValue.DISALLOW_GOOGLE_OIDC, |
| 3612 | + "Google", |
| 3613 | + lambda i, user_id: PendingGooglePublisher( |
| 3614 | + project_name="some-project-name-" + str(i), |
| 3615 | + email="some-email-" + str(i) + "@example.com", |
| 3616 | + sub="some-sub", |
| 3617 | + added_by_id=user_id, |
| 3618 | + ), |
| 3619 | + PendingGooglePublisher, |
| 3620 | + ), |
3599 | 3621 | ],
|
3600 | 3622 | )
|
3601 | 3623 | def test_add_pending_github_oidc_publisher_too_many_already(
|
@@ -3663,6 +3685,10 @@ def test_add_pending_github_oidc_publisher_too_many_already(
|
3663 | 3685 | "add_pending_github_oidc_publisher",
|
3664 | 3686 | "GitHub",
|
3665 | 3687 | ),
|
| 3688 | + ( |
| 3689 | + "add_pending_google_oidc_publisher", |
| 3690 | + "Google", |
| 3691 | + ), |
3666 | 3692 | ],
|
3667 | 3693 | )
|
3668 | 3694 | def test_add_pending_oidc_publisher_ratelimited(
|
@@ -3725,6 +3751,10 @@ def test_add_pending_oidc_publisher_ratelimited(
|
3725 | 3751 | "add_pending_github_oidc_publisher",
|
3726 | 3752 | "GitHub",
|
3727 | 3753 | ),
|
| 3754 | + ( |
| 3755 | + "add_pending_google_oidc_publisher", |
| 3756 | + "Google", |
| 3757 | + ), |
3728 | 3758 | ],
|
3729 | 3759 | )
|
3730 | 3760 | def test_add_pending_oidc_publisher_invalid_form(
|
@@ -3814,6 +3844,23 @@ def test_add_pending_oidc_publisher_invalid_form(
|
3814 | 3844 | }
|
3815 | 3845 | ),
|
3816 | 3846 | ),
|
| 3847 | + ( |
| 3848 | + "add_pending_google_oidc_publisher", |
| 3849 | + "Google", |
| 3850 | + lambda user_id: PendingGooglePublisher( |
| 3851 | + project_name="some-project-name", |
| 3852 | + |
| 3853 | + sub="some-sub", |
| 3854 | + added_by_id=user_id, |
| 3855 | + ), |
| 3856 | + MultiDict( |
| 3857 | + { |
| 3858 | + |
| 3859 | + "sub": "some-sub", |
| 3860 | + "project_name": "some-project-name", |
| 3861 | + } |
| 3862 | + ), |
| 3863 | + ), |
3817 | 3864 | ],
|
3818 | 3865 | )
|
3819 | 3866 | def test_add_pending_oidc_publisher_already_exists(
|
@@ -3900,6 +3947,18 @@ def test_add_pending_oidc_publisher_already_exists(
|
3900 | 3947 | ),
|
3901 | 3948 | PendingGitHubPublisher,
|
3902 | 3949 | ),
|
| 3950 | + ( |
| 3951 | + "add_pending_google_oidc_publisher", |
| 3952 | + "Google", |
| 3953 | + MultiDict( |
| 3954 | + { |
| 3955 | + |
| 3956 | + "sub": "some-sub", |
| 3957 | + "project_name": "some-project-name", |
| 3958 | + } |
| 3959 | + ), |
| 3960 | + PendingGooglePublisher, |
| 3961 | + ), |
3903 | 3962 | ],
|
3904 | 3963 | )
|
3905 | 3964 | def test_add_pending_oidc_publisher(
|
@@ -4091,6 +4150,15 @@ def test_delete_pending_oidc_publisher_invalid_form(
|
4091 | 4150 | ),
|
4092 | 4151 | PendingGitHubPublisher,
|
4093 | 4152 | ),
|
| 4153 | + ( |
| 4154 | + lambda user_id: PendingGooglePublisher( |
| 4155 | + project_name="some-project-name", |
| 4156 | + |
| 4157 | + sub="some-sub", |
| 4158 | + added_by_id=user_id, |
| 4159 | + ), |
| 4160 | + PendingGooglePublisher, |
| 4161 | + ), |
4094 | 4162 | ],
|
4095 | 4163 | )
|
4096 | 4164 | def test_delete_pending_oidc_publisher_not_found(
|
@@ -4142,6 +4210,15 @@ def test_delete_pending_oidc_publisher_not_found(
|
4142 | 4210 | ),
|
4143 | 4211 | PendingGitHubPublisher,
|
4144 | 4212 | ),
|
| 4213 | + ( |
| 4214 | + lambda user_id: PendingGooglePublisher( |
| 4215 | + project_name="some-project-name", |
| 4216 | + |
| 4217 | + sub="some-sub", |
| 4218 | + added_by_id=user_id, |
| 4219 | + ), |
| 4220 | + PendingGooglePublisher, |
| 4221 | + ), |
4145 | 4222 | ],
|
4146 | 4223 | )
|
4147 | 4224 | def test_delete_pending_oidc_publisher_no_access(
|
@@ -4197,6 +4274,16 @@ def test_delete_pending_oidc_publisher_no_access(
|
4197 | 4274 | ),
|
4198 | 4275 | PendingGitHubPublisher,
|
4199 | 4276 | ),
|
| 4277 | + ( |
| 4278 | + "Google", |
| 4279 | + lambda user_id: PendingGooglePublisher( |
| 4280 | + project_name="some-project-name", |
| 4281 | + |
| 4282 | + sub="some-sub", |
| 4283 | + added_by_id=user_id, |
| 4284 | + ), |
| 4285 | + PendingGooglePublisher, |
| 4286 | + ), |
4200 | 4287 | ],
|
4201 | 4288 | )
|
4202 | 4289 | def test_delete_pending_oidc_publisher(
|
|
0 commit comments