diff --git a/tests/unit/accounts/test_views.py b/tests/unit/accounts/test_views.py
index 34918c374c3e..a877ad27ea8c 100644
--- a/tests/unit/accounts/test_views.py
+++ b/tests/unit/accounts/test_views.py
@@ -20,7 +20,6 @@
import pretend
import pytest
import pytz
-import wtforms
from pyramid.httpexceptions import (
HTTPBadRequest,
@@ -59,9 +58,9 @@
from warehouse.metrics.interfaces import IMetricsService
from warehouse.oidc.interfaces import TooManyOIDCRegistrations
from warehouse.oidc.models import (
+ PendingActiveStatePublisher,
PendingGitHubPublisher,
PendingGooglePublisher,
- PendingActiveStatePublisher,
)
from warehouse.organizations.models import (
OrganizationInvitation,
@@ -4252,6 +4251,86 @@ def test_add_pending_oidc_publisher(
)
]
+ def test_delete_pending_oidc_publisher_admin_disabled(
+ self, monkeypatch, pyramid_request
+ ):
+ pyramid_request.user = pretend.stub()
+ pyramid_request.registry = pretend.stub(
+ settings={
+ "github.token": "fake-api-token",
+ }
+ )
+ pyramid_request.flags = pretend.stub(
+ disallow_oidc=pretend.call_recorder(lambda f=None: True)
+ )
+ pyramid_request.session = pretend.stub(
+ flash=pretend.call_recorder(lambda *a, **kw: None)
+ )
+
+ project_factory = pretend.stub()
+ project_factory_cls = pretend.call_recorder(lambda r: project_factory)
+ monkeypatch.setattr(views, "ProjectFactory", project_factory_cls)
+
+ pending_github_publisher_form_obj = pretend.stub()
+ pending_github_publisher_form_cls = pretend.call_recorder(
+ lambda *a, **kw: pending_github_publisher_form_obj
+ )
+ monkeypatch.setattr(
+ views, "PendingGitHubPublisherForm", pending_github_publisher_form_cls
+ )
+ pending_google_publisher_form_obj = pretend.stub()
+ pending_google_publisher_form_cls = pretend.call_recorder(
+ lambda *a, **kw: pending_google_publisher_form_obj
+ )
+ monkeypatch.setattr(
+ views, "PendingGooglePublisherForm", pending_google_publisher_form_cls
+ )
+ pending_activestate_publisher_form_obj = pretend.stub()
+ pending_activestate_publisher_form_cls = pretend.call_recorder(
+ lambda *a, **kw: pending_activestate_publisher_form_obj
+ )
+ monkeypatch.setattr(
+ views,
+ "PendingActiveStatePublisherForm",
+ pending_activestate_publisher_form_cls,
+ )
+
+ view = views.ManageAccountPublishingViews(pyramid_request)
+
+ assert view.delete_pending_oidc_publisher() == {
+ "disabled": {
+ "GitHub": True,
+ "Google": True,
+ "ActiveState": True,
+ },
+ "pending_github_publisher_form": pending_github_publisher_form_obj,
+ "pending_google_publisher_form": pending_google_publisher_form_obj,
+ "pending_activestate_publisher_form": pending_activestate_publisher_form_obj,
+ }
+
+ assert pyramid_request.flags.disallow_oidc.calls == [
+ pretend.call(),
+ pretend.call(AdminFlagValue.DISALLOW_GITHUB_OIDC),
+ pretend.call(AdminFlagValue.DISALLOW_GOOGLE_OIDC),
+ pretend.call(AdminFlagValue.DISALLOW_ACTIVESTATE_OIDC),
+ ]
+ assert pyramid_request.session.flash.calls == [
+ pretend.call(
+ (
+ "Trusted publishing is temporarily disabled. "
+ "See https://pypi.org/help#admin-intervention for details."
+ ),
+ queue="error",
+ )
+ ]
+ assert pending_github_publisher_form_cls.calls == [
+ pretend.call(
+ pyramid_request.POST,
+ api_token="fake-api-token",
+ project_factory=project_factory,
+ )
+ ]
+
def test_delete_pending_oidc_publisher_invalid_form(
self, monkeypatch, pyramid_request
):
diff --git a/tests/unit/oidc/forms/test_activestate.py b/tests/unit/oidc/forms/test_activestate.py
index 4b876c3bf819..2241c72f02e6 100644
--- a/tests/unit/oidc/forms/test_activestate.py
+++ b/tests/unit/oidc/forms/test_activestate.py
@@ -12,6 +12,7 @@
import pretend
import pytest
+import requests
import wtforms
from requests import ConnectionError, HTTPError, Timeout
@@ -26,6 +27,12 @@
fake_gql_org_response = {"data": {"organizations": [fake_org_info]}}
fake_gql_user_response = {"data": {"users": [fake_user_info]}}
+_requests = requests
+
+
+def _raise(exception):
+ raise exception
+
class TestPendingActiveStatePublisherForm:
def test_validate(self, monkeypatch):
@@ -137,8 +144,7 @@ def test_lookup_actor_other_http_error(self, monkeypatch):
assert sentry_sdk.capture_message.calls == [
pretend.call(
- "Unexpected error from ActiveState user lookup: "
- "response.content=b'fake-content'"
+ "Unexpected error from ActiveState actor lookup: " "b'fake-content'"
)
]
@@ -159,7 +165,7 @@ def test_lookup_actor_http_timeout(self, monkeypatch):
form._lookup_actor(fake_username)
assert sentry_sdk.capture_message.calls == [
- pretend.call("Timeout from ActiveState user lookup API (possibly offline)")
+ pretend.call("Timeout from ActiveState actor lookup API (possibly offline)")
]
def test_lookup_actor_connection_error(self, monkeypatch):
@@ -180,10 +186,36 @@ def test_lookup_actor_connection_error(self, monkeypatch):
assert sentry_sdk.capture_message.calls == [
pretend.call(
- "Connection error from ActiveState user lookup API (possibly offline)"
+ "Connection error from ActiveState actor lookup API (possibly offline)"
)
]
+ def test_lookup_actor_non_json(self, monkeypatch):
+ response = pretend.stub(
+ status_code=200,
+ raise_for_status=pretend.call_recorder(lambda: None),
+ json=lambda: _raise(_requests.exceptions.JSONDecodeError("", "", 0)),
+ content=b"",
+ )
+
+ requests = pretend.stub(
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
+ )
+ monkeypatch.setattr(activestate, "requests", requests)
+
+ sentry_sdk = pretend.stub(capture_message=pretend.call_recorder(lambda s: None))
+ monkeypatch.setattr(activestate, "sentry_sdk", sentry_sdk)
+
+ form = activestate.ActiveStatePublisherForm()
+ with pytest.raises(wtforms.validators.ValidationError):
+ form._lookup_actor(fake_username)
+
+ assert sentry_sdk.capture_message.calls == [
+ pretend.call("Unexpected error from ActiveState actor lookup: b''") # noqa
+ ]
+
def test_lookup_actor_gql_error(self, monkeypatch):
response = pretend.stub(
status_code=200,
@@ -192,7 +224,9 @@ def test_lookup_actor_gql_error(self, monkeypatch):
content=b"fake-content",
)
requests = pretend.stub(
- post=pretend.call_recorder(lambda o, **kw: response), HTTPError=HTTPError
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
)
monkeypatch.setattr(activestate, "requests", requests)
@@ -215,7 +249,7 @@ def test_lookup_actor_gql_error(self, monkeypatch):
]
assert sentry_sdk.capture_message.calls == [
pretend.call(
- "Unexpected error from ActiveState user lookup: ['some error']"
+ "Unexpected error from ActiveState actor lookup: ['some error']"
)
]
@@ -226,7 +260,9 @@ def test_lookup_actor_gql_no_data(self, monkeypatch):
json=lambda: {"data": {"users": []}},
)
requests = pretend.stub(
- post=pretend.call_recorder(lambda o, **kw: response), HTTPError=HTTPError
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
)
monkeypatch.setattr(activestate, "requests", requests)
@@ -280,7 +316,9 @@ def test_lookup_organization_404(self, monkeypatch):
content=b"fake-content",
)
requests = pretend.stub(
- post=pretend.call_recorder(lambda o, **kw: response), HTTPError=HTTPError
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
)
monkeypatch.setattr(activestate, "requests", requests)
@@ -333,8 +371,8 @@ def test_lookup_organization_other_http_error(self, monkeypatch):
assert sentry_sdk.capture_message.calls == [
pretend.call(
- "Unexpected error from ActiveState user lookup: "
- "response.content=b'fake-content'"
+ "Unexpected error from ActiveState organization lookup: "
+ "b'fake-content'"
)
]
@@ -355,7 +393,9 @@ def test_lookup_organization_http_timeout(self, monkeypatch):
form._lookup_organization(fake_org_name)
assert sentry_sdk.capture_message.calls == [
- pretend.call("Timeout from ActiveState user lookup API (possibly offline)")
+ pretend.call(
+ "Timeout from ActiveState organization lookup API (possibly offline)"
+ )
]
def test_lookup_organization_connection_error(self, monkeypatch):
@@ -376,7 +416,35 @@ def test_lookup_organization_connection_error(self, monkeypatch):
assert sentry_sdk.capture_message.calls == [
pretend.call(
- "Connection error from ActiveState user lookup API (possibly offline)"
+ "Connection error from ActiveState organization lookup API (possibly offline)" # noqa
+ )
+ ]
+
+ def test_lookup_organization_non_json(self, monkeypatch):
+ response = pretend.stub(
+ status_code=200,
+ raise_for_status=pretend.call_recorder(lambda: None),
+ json=lambda: _raise(_requests.exceptions.JSONDecodeError("", "", 0)),
+ content=b"",
+ )
+
+ requests = pretend.stub(
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
+ )
+ monkeypatch.setattr(activestate, "requests", requests)
+
+ sentry_sdk = pretend.stub(capture_message=pretend.call_recorder(lambda s: None))
+ monkeypatch.setattr(activestate, "sentry_sdk", sentry_sdk)
+
+ form = activestate.ActiveStatePublisherForm()
+ with pytest.raises(wtforms.validators.ValidationError):
+ form._lookup_organization(fake_org_name)
+
+ assert sentry_sdk.capture_message.calls == [
+ pretend.call(
+ "Unexpected error from ActiveState organization lookup: b''" # noqa
)
]
@@ -385,10 +453,13 @@ def test_lookup_organization_gql_error(self, monkeypatch):
status_code=200,
raise_for_status=pretend.call_recorder(lambda: None),
json=lambda: {"errors": ["some error"]},
- content=b"fake-content",
+ content=b'{"errors": ["some error"]}',
)
+
requests = pretend.stub(
- post=pretend.call_recorder(lambda o, **kw: response), HTTPError=HTTPError
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
)
monkeypatch.setattr(activestate, "requests", requests)
@@ -411,7 +482,7 @@ def test_lookup_organization_gql_error(self, monkeypatch):
]
assert sentry_sdk.capture_message.calls == [
pretend.call(
- "Unexpected error from ActiveState user lookup: ['some error']"
+ "Unexpected error from ActiveState organization lookup: ['some error']"
)
]
@@ -420,9 +491,12 @@ def test_lookup_organization_gql_no_data(self, monkeypatch):
status_code=200,
raise_for_status=pretend.call_recorder(lambda: None),
json=lambda: {"data": {"organizations": []}},
+ content='{"data": {"organizations": []}}',
)
requests = pretend.stub(
- post=pretend.call_recorder(lambda o, **kw: response), HTTPError=HTTPError
+ post=pretend.call_recorder(lambda o, **kw: response),
+ HTTPError=HTTPError,
+ exceptions=_requests.exceptions,
)
monkeypatch.setattr(activestate, "requests", requests)
diff --git a/warehouse/accounts/views.py b/warehouse/accounts/views.py
index 51421dd00afb..02c13deed011 100644
--- a/warehouse/accounts/views.py
+++ b/warehouse/accounts/views.py
@@ -1520,7 +1520,7 @@ def default_response(self):
return {
"pending_github_publisher_form": self.pending_github_publisher_form,
"pending_google_publisher_form": self.pending_google_publisher_form,
- "pending_activestate_publisher_form": self.pending_activestate_publisher_form,
+ "pending_activestate_publisher_form": self.pending_activestate_publisher_form, # noqa
"disabled": {
"GitHub": self.request.flags.disallow_oidc(
AdminFlagValue.DISALLOW_GITHUB_OIDC
diff --git a/warehouse/locale/messages.pot b/warehouse/locale/messages.pot
index 6a1c280e0865..20684c06ba3c 100644
--- a/warehouse/locale/messages.pot
+++ b/warehouse/locale/messages.pot
@@ -114,418 +114,221 @@ msgstr ""
msgid "No user found with that username or email"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:115
-=======
-#: warehouse/accounts/views.py:113
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:117
msgid ""
"There have been too many unsuccessful login attempts. You have been "
"locked out for {}. Please try again later."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:132
-=======
-#: warehouse/accounts/views.py:130
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:134
msgid ""
"Too many emails have been added to this account without verifying them. "
"Check your inbox and follow the verification links. (IP: ${ip})"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:144
-=======
-#: warehouse/accounts/views.py:142
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:146
msgid ""
"Too many password resets have been requested for this account without "
"completing them. Check your inbox and follow the verification links. (IP:"
" ${ip})"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:328 warehouse/accounts/views.py:397
-#: warehouse/accounts/views.py:399 warehouse/accounts/views.py:428
-#: warehouse/accounts/views.py:430 warehouse/accounts/views.py:536
+#: warehouse/accounts/views.py:330 warehouse/accounts/views.py:399
+#: warehouse/accounts/views.py:401 warehouse/accounts/views.py:430
+#: warehouse/accounts/views.py:432 warehouse/accounts/views.py:538
msgid "Invalid or expired two factor login."
msgstr ""
-#: warehouse/accounts/views.py:391
+#: warehouse/accounts/views.py:393
msgid "Already authenticated"
msgstr ""
-#: warehouse/accounts/views.py:471
+#: warehouse/accounts/views.py:473
msgid "Successful WebAuthn assertion"
msgstr ""
-#: warehouse/accounts/views.py:567 warehouse/manage/views/__init__.py:826
+#: warehouse/accounts/views.py:569 warehouse/manage/views/__init__.py:826
msgid "Recovery code accepted. The supplied code cannot be used again."
msgstr ""
-#: warehouse/accounts/views.py:659
-=======
-#: warehouse/accounts/views.py:326 warehouse/accounts/views.py:395
-#: warehouse/accounts/views.py:397 warehouse/accounts/views.py:426
-#: warehouse/accounts/views.py:428 warehouse/accounts/views.py:534
-msgid "Invalid or expired two factor login."
-msgstr ""
-
-#: warehouse/accounts/views.py:389
-msgid "Already authenticated"
-msgstr ""
-
-#: warehouse/accounts/views.py:469
-msgid "Successful WebAuthn assertion"
-msgstr ""
-
-#: warehouse/accounts/views.py:565 warehouse/manage/views/__init__.py:823
-msgid "Recovery code accepted. The supplied code cannot be used again."
-msgstr ""
-
-#: warehouse/accounts/views.py:657
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:661
msgid ""
"New user registration temporarily disabled. See https://pypi.org/help"
"#admin-intervention for details."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:790
-msgid "Expired token: request a new password reset link"
-msgstr ""
-
#: warehouse/accounts/views.py:792
-msgid "Invalid token: request a new password reset link"
-msgstr ""
-
-#: warehouse/accounts/views.py:794 warehouse/accounts/views.py:907
-#: warehouse/accounts/views.py:1011 warehouse/accounts/views.py:1180
-msgid "Invalid token: no token supplied"
-msgstr ""
-
-#: warehouse/accounts/views.py:798
-msgid "Invalid token: not a password reset token"
-msgstr ""
-
-#: warehouse/accounts/views.py:803
-msgid "Invalid token: user not found"
-msgstr ""
-
-#: warehouse/accounts/views.py:825
-msgid "Invalid token: user has logged in since this token was requested"
-msgstr ""
-
-#: warehouse/accounts/views.py:843
-=======
-#: warehouse/accounts/views.py:788
msgid "Expired token: request a new password reset link"
msgstr ""
-#: warehouse/accounts/views.py:790
+#: warehouse/accounts/views.py:794
msgid "Invalid token: request a new password reset link"
msgstr ""
-#: warehouse/accounts/views.py:792 warehouse/accounts/views.py:905
-#: warehouse/accounts/views.py:1009 warehouse/accounts/views.py:1178
+#: warehouse/accounts/views.py:796 warehouse/accounts/views.py:909
+#: warehouse/accounts/views.py:1013 warehouse/accounts/views.py:1182
msgid "Invalid token: no token supplied"
msgstr ""
-#: warehouse/accounts/views.py:796
+#: warehouse/accounts/views.py:800
msgid "Invalid token: not a password reset token"
msgstr ""
-#: warehouse/accounts/views.py:801
+#: warehouse/accounts/views.py:805
msgid "Invalid token: user not found"
msgstr ""
-#: warehouse/accounts/views.py:823
+#: warehouse/accounts/views.py:827
msgid "Invalid token: user has logged in since this token was requested"
msgstr ""
-#: warehouse/accounts/views.py:841
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:845
msgid ""
"Invalid token: password has already been changed since this token was "
"requested"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:875
+#: warehouse/accounts/views.py:877
msgid "You have reset your password"
msgstr ""
-#: warehouse/accounts/views.py:903
-msgid "Expired token: request a new email verification link"
-msgstr ""
-
#: warehouse/accounts/views.py:905
-msgid "Invalid token: request a new email verification link"
-msgstr ""
-
-#: warehouse/accounts/views.py:911
-msgid "Invalid token: not an email verification token"
-msgstr ""
-
-#: warehouse/accounts/views.py:920
-msgid "Email not found"
-msgstr ""
-
-#: warehouse/accounts/views.py:923
-msgid "Email already verified"
-msgstr ""
-
-#: warehouse/accounts/views.py:940
-msgid "You can now set this email as your primary address"
-msgstr ""
-
-#: warehouse/accounts/views.py:944
-msgid "This is your primary address"
-msgstr ""
-
-#: warehouse/accounts/views.py:949
-msgid "Email address ${email_address} verified. ${confirm_message}."
-msgstr ""
-
-#: warehouse/accounts/views.py:1007
-msgid "Expired token: request a new organization invitation"
-msgstr ""
-
-#: warehouse/accounts/views.py:1009
-msgid "Invalid token: request a new organization invitation"
-msgstr ""
-
-#: warehouse/accounts/views.py:1015
-msgid "Invalid token: not an organization invitation token"
-msgstr ""
-
-#: warehouse/accounts/views.py:1019
-msgid "Organization invitation is not valid."
-msgstr ""
-
-#: warehouse/accounts/views.py:1028
-msgid "Organization invitation no longer exists."
-msgstr ""
-
-#: warehouse/accounts/views.py:1079
-msgid "Invitation for '${organization_name}' is declined."
-msgstr ""
-
-#: warehouse/accounts/views.py:1142
-msgid "You are now ${role} of the '${organization_name}' organization."
-msgstr ""
-
-#: warehouse/accounts/views.py:1176
-msgid "Expired token: request a new project role invitation"
-msgstr ""
-
-#: warehouse/accounts/views.py:1178
-msgid "Invalid token: request a new project role invitation"
-msgstr ""
-
-#: warehouse/accounts/views.py:1184
-msgid "Invalid token: not a collaboration invitation token"
-msgstr ""
-
-#: warehouse/accounts/views.py:1188
-msgid "Role invitation is not valid."
-msgstr ""
-
-#: warehouse/accounts/views.py:1203
-msgid "Role invitation no longer exists."
-msgstr ""
-
-#: warehouse/accounts/views.py:1234
-msgid "Invitation for '${project_name}' is declined."
-msgstr ""
-
-#: warehouse/accounts/views.py:1300
-msgid "You are now ${role} of the '${project_name}' project."
-msgstr ""
-
-#: warehouse/accounts/views.py:1531 warehouse/accounts/views.py:1721
-#: warehouse/manage/views/__init__.py:1193
-=======
-#: warehouse/accounts/views.py:873
-msgid "You have reset your password"
-msgstr ""
-
-#: warehouse/accounts/views.py:901
msgid "Expired token: request a new email verification link"
msgstr ""
-#: warehouse/accounts/views.py:903
+#: warehouse/accounts/views.py:907
msgid "Invalid token: request a new email verification link"
msgstr ""
-#: warehouse/accounts/views.py:909
+#: warehouse/accounts/views.py:913
msgid "Invalid token: not an email verification token"
msgstr ""
-#: warehouse/accounts/views.py:918
+#: warehouse/accounts/views.py:922
msgid "Email not found"
msgstr ""
-#: warehouse/accounts/views.py:921
+#: warehouse/accounts/views.py:925
msgid "Email already verified"
msgstr ""
-#: warehouse/accounts/views.py:938
+#: warehouse/accounts/views.py:942
msgid "You can now set this email as your primary address"
msgstr ""
-#: warehouse/accounts/views.py:942
+#: warehouse/accounts/views.py:946
msgid "This is your primary address"
msgstr ""
-#: warehouse/accounts/views.py:947
+#: warehouse/accounts/views.py:951
msgid "Email address ${email_address} verified. ${confirm_message}."
msgstr ""
-#: warehouse/accounts/views.py:1005
+#: warehouse/accounts/views.py:1009
msgid "Expired token: request a new organization invitation"
msgstr ""
-#: warehouse/accounts/views.py:1007
+#: warehouse/accounts/views.py:1011
msgid "Invalid token: request a new organization invitation"
msgstr ""
-#: warehouse/accounts/views.py:1013
+#: warehouse/accounts/views.py:1017
msgid "Invalid token: not an organization invitation token"
msgstr ""
-#: warehouse/accounts/views.py:1017
+#: warehouse/accounts/views.py:1021
msgid "Organization invitation is not valid."
msgstr ""
-#: warehouse/accounts/views.py:1026
+#: warehouse/accounts/views.py:1030
msgid "Organization invitation no longer exists."
msgstr ""
-#: warehouse/accounts/views.py:1077
+#: warehouse/accounts/views.py:1081
msgid "Invitation for '${organization_name}' is declined."
msgstr ""
-#: warehouse/accounts/views.py:1140
+#: warehouse/accounts/views.py:1144
msgid "You are now ${role} of the '${organization_name}' organization."
msgstr ""
-#: warehouse/accounts/views.py:1174
+#: warehouse/accounts/views.py:1178
msgid "Expired token: request a new project role invitation"
msgstr ""
-#: warehouse/accounts/views.py:1176
+#: warehouse/accounts/views.py:1180
msgid "Invalid token: request a new project role invitation"
msgstr ""
-#: warehouse/accounts/views.py:1182
+#: warehouse/accounts/views.py:1186
msgid "Invalid token: not a collaboration invitation token"
msgstr ""
-#: warehouse/accounts/views.py:1186
+#: warehouse/accounts/views.py:1190
msgid "Role invitation is not valid."
msgstr ""
-#: warehouse/accounts/views.py:1201
+#: warehouse/accounts/views.py:1205
msgid "Role invitation no longer exists."
msgstr ""
-#: warehouse/accounts/views.py:1232
+#: warehouse/accounts/views.py:1236
msgid "Invitation for '${project_name}' is declined."
msgstr ""
-#: warehouse/accounts/views.py:1298
+#: warehouse/accounts/views.py:1302
msgid "You are now ${role} of the '${project_name}' project."
msgstr ""
-#: warehouse/accounts/views.py:1521 warehouse/accounts/views.py:1712
-#: warehouse/manage/views/__init__.py:1180
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:1541 warehouse/accounts/views.py:1757
+#: warehouse/manage/views/__init__.py:1193
msgid ""
"Trusted publishing is temporarily disabled. See https://pypi.org/help"
"#admin-intervention for details."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:1552
+#: warehouse/accounts/views.py:1562
msgid "disabled. See https://pypi.org/help#admin-intervention for details."
msgstr ""
-#: warehouse/accounts/views.py:1568
-=======
-#: warehouse/accounts/views.py:1542
-msgid "disabled. See https://pypi.org/help#admin-intervention for details."
-msgstr ""
-
-#: warehouse/accounts/views.py:1557
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:1578
msgid ""
"You must have a verified email in order to register a pending trusted "
"publisher. See https://pypi.org/help#openid-connect for details."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:1581
+#: warehouse/accounts/views.py:1591
msgid "You can't register more than 3 pending trusted publishers at once."
msgstr ""
-#: warehouse/accounts/views.py:1597 warehouse/manage/views/__init__.py:1228
+#: warehouse/accounts/views.py:1607 warehouse/manage/views/__init__.py:1228
#: warehouse/manage/views/__init__.py:1341
-=======
-#: warehouse/accounts/views.py:1569
-msgid "You can't register more than 3 pending trusted publishers at once."
-msgstr ""
-
-#: warehouse/accounts/views.py:1585 warehouse/manage/views/__init__.py:1215
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
msgid ""
"There have been too many attempted trusted publisher registrations. Try "
"again later."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:1608 warehouse/manage/views/__init__.py:1242
+#: warehouse/accounts/views.py:1618 warehouse/manage/views/__init__.py:1242
#: warehouse/manage/views/__init__.py:1355
msgid "The trusted publisher could not be registered"
msgstr ""
-#: warehouse/accounts/views.py:1622
-=======
-#: warehouse/accounts/views.py:1596 warehouse/manage/views/__init__.py:1229
-msgid "The trusted publisher could not be registered"
-msgstr ""
-
-#: warehouse/accounts/views.py:1610
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:1632
msgid ""
"This trusted publisher has already been registered. Please contact PyPI's"
" admins if this wasn't intentional."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/accounts/views.py:1649
-msgid "Registered a new pending publisher to create "
-msgstr ""
-
-#: warehouse/accounts/views.py:1735 warehouse/accounts/views.py:1748
-#: warehouse/accounts/views.py:1755
-msgid "Invalid publisher ID"
-msgstr ""
-
-#: warehouse/accounts/views.py:1761
-=======
-#: warehouse/accounts/views.py:1637
+#: warehouse/accounts/views.py:1659
msgid "Registered a new pending publisher to create "
msgstr ""
-#: warehouse/accounts/views.py:1726 warehouse/accounts/views.py:1739
-#: warehouse/accounts/views.py:1746
+#: warehouse/accounts/views.py:1771 warehouse/accounts/views.py:1784
+#: warehouse/accounts/views.py:1791
msgid "Invalid publisher ID"
msgstr ""
-#: warehouse/accounts/views.py:1752
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/accounts/views.py:1797
msgid "Removed trusted publisher for project "
msgstr ""
@@ -562,7 +365,7 @@ msgid "Select project"
msgstr ""
#: warehouse/manage/forms.py:495 warehouse/oidc/forms/_core.py:23
-#: warehouse/oidc/forms/activestate.py:195
+#: warehouse/oidc/forms/activestate.py:224
msgid "Specify project name"
msgstr ""
@@ -755,11 +558,11 @@ msgstr ""
msgid "Expired invitation for '${username}' deleted."
msgstr ""
-#: warehouse/oidc/forms/_core.py:25 warehouse/oidc/forms/activestate.py:197
+#: warehouse/oidc/forms/_core.py:25 warehouse/oidc/forms/activestate.py:226
msgid "Invalid project name"
msgstr ""
-#: warehouse/oidc/forms/_core.py:35 warehouse/oidc/forms/activestate.py:211
+#: warehouse/oidc/forms/_core.py:35 warehouse/oidc/forms/activestate.py:240
msgid "This project name is already in use"
msgstr ""
@@ -771,44 +574,46 @@ msgstr ""
msgid "Publisher must be specified by ID"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:40
-msgid "Specify ActiveState Organization URL name"
+#: warehouse/oidc/forms/activestate.py:46
+msgid "Specify ActiveState organization name"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:44
-msgid "Invalid ActiveState Platform organization name"
+#: warehouse/oidc/forms/activestate.py:50
+msgid "Invalid ActiveState organization name"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:52
+#: warehouse/oidc/forms/activestate.py:58
msgid "Specify ActiveState project name"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:56
-msgid "Invalid ActiveState Platform project name"
+#: warehouse/oidc/forms/activestate.py:62
+msgid "Invalid ActiveState project name"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:92
-#: warehouse/oidc/forms/activestate.py:119
-#: warehouse/oidc/forms/activestate.py:148
-#: warehouse/oidc/forms/activestate.py:174
+#: warehouse/oidc/forms/activestate.py:100
+#: warehouse/oidc/forms/activestate.py:128
+#: warehouse/oidc/forms/activestate.py:142
+#: warehouse/oidc/forms/activestate.py:166
+#: warehouse/oidc/forms/activestate.py:194
+#: warehouse/oidc/forms/activestate.py:208
msgid "Unexpected error from ActiveState. Try again"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:99
-#: warehouse/oidc/forms/activestate.py:155
+#: warehouse/oidc/forms/activestate.py:107
+#: warehouse/oidc/forms/activestate.py:173
msgid "Unexpected connection error from ActiveState. Try again in a few minutes"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:109
-#: warehouse/oidc/forms/activestate.py:165
+#: warehouse/oidc/forms/activestate.py:117
+#: warehouse/oidc/forms/activestate.py:183
msgid "Unexpected timeout from ActiveState. Try again in a few minutes"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:124
+#: warehouse/oidc/forms/activestate.py:135
msgid "ActiveState organization not found"
msgstr ""
-#: warehouse/oidc/forms/activestate.py:180
+#: warehouse/oidc/forms/activestate.py:201
msgid "ActiveState actor not found"
msgstr ""
@@ -1495,7 +1300,6 @@ msgstr ""
#: warehouse/templates/manage/account.html:369
#: warehouse/templates/manage/account.html:386
#: warehouse/templates/manage/account.html:402
-<<<<<<< HEAD
#: warehouse/templates/manage/account/publishing.html:40
#: warehouse/templates/manage/account/publishing.html:55
#: warehouse/templates/manage/account/publishing.html:70
@@ -1504,17 +1308,10 @@ msgstr ""
#: warehouse/templates/manage/account/publishing.html:142
#: warehouse/templates/manage/account/publishing.html:157
#: warehouse/templates/manage/account/publishing.html:172
-=======
-#: warehouse/templates/manage/account/publishing.html:34
-#: warehouse/templates/manage/account/publishing.html:49
-#: warehouse/templates/manage/account/publishing.html:64
-#: warehouse/templates/manage/account/publishing.html:79
-#: warehouse/templates/manage/account/publishing.html:94
-#: warehouse/templates/manage/account/publishing.html:130
-#: warehouse/templates/manage/account/publishing.html:145
-#: warehouse/templates/manage/account/publishing.html:160
-#: warehouse/templates/manage/account/publishing.html:175
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/account/publishing.html:200
+#: warehouse/templates/manage/account/publishing.html:215
+#: warehouse/templates/manage/account/publishing.html:230
+#: warehouse/templates/manage/account/publishing.html:245
#: warehouse/templates/manage/account/recovery_codes-burn.html:70
#: warehouse/templates/manage/account/token.html:133
#: warehouse/templates/manage/account/token.html:150
@@ -3946,11 +3743,7 @@ msgstr ""
#: warehouse/templates/manage/manage_base.html:80
#: warehouse/templates/manage/manage_base.html:97
#: warehouse/templates/manage/manage_base.html:100
-<<<<<<< HEAD
-#: warehouse/templates/manage/manage_base.html:562
-=======
-#: warehouse/templates/manage/manage_base.html:565
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/manage_base.html:569
#: warehouse/templates/manage/organization/roles.html:202
#: warehouse/templates/manage/organization/roles.html:204
#: warehouse/templates/manage/organization/roles.html:209
@@ -4134,20 +3927,12 @@ msgid ""
"href=\"%(href)s\">here."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/templates/manage/manage_base.html:546
-#: warehouse/templates/manage/manage_base.html:554
-msgid "Any"
-msgstr ""
-
-#: warehouse/templates/manage/manage_base.html:569
-=======
-#: warehouse/templates/manage/manage_base.html:553
+#: warehouse/templates/manage/manage_base.html:549
+#: warehouse/templates/manage/manage_base.html:557
msgid "Any"
msgstr ""
-#: warehouse/templates/manage/manage_base.html:572
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/manage_base.html:576
#: warehouse/templates/manage/organization/history.html:166
#: warehouse/templates/manage/project/history.html:43
#: warehouse/templates/manage/project/history.html:97
@@ -4158,11 +3943,7 @@ msgstr ""
msgid "Added by:"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/templates/manage/manage_base.html:571
-=======
-#: warehouse/templates/manage/manage_base.html:574
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/manage_base.html:578
#: warehouse/templates/manage/organization/history.html:171
#: warehouse/templates/manage/project/history.html:62
#: warehouse/templates/manage/project/history.html:128
@@ -4173,44 +3954,24 @@ msgstr ""
msgid "Removed by:"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/templates/manage/manage_base.html:573
+#: warehouse/templates/manage/manage_base.html:580
msgid "Submitted by:"
msgstr ""
-#: warehouse/templates/manage/manage_base.html:576
-=======
-#: warehouse/templates/manage/manage_base.html:576
-msgid "Submitted by:"
-msgstr ""
-
-#: warehouse/templates/manage/manage_base.html:579
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/manage_base.html:583
#: warehouse/templates/manage/project/history.html:247
msgid "Workflow:"
msgstr ""
-<<<<<<< HEAD
-#: warehouse/templates/manage/manage_base.html:578
-msgid "Specifier:"
-msgstr ""
-
-#: warehouse/templates/manage/manage_base.html:581
-msgid "Publisher:"
-msgstr ""
-
-#: warehouse/templates/manage/manage_base.html:583
-=======
-#: warehouse/templates/manage/manage_base.html:581
+#: warehouse/templates/manage/manage_base.html:585
msgid "Specifier:"
msgstr ""
-#: warehouse/templates/manage/manage_base.html:584
+#: warehouse/templates/manage/manage_base.html:588
msgid "Publisher:"
msgstr ""
-#: warehouse/templates/manage/manage_base.html:586
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/manage_base.html:590
#: warehouse/templates/manage/project/history.html:52
#: warehouse/templates/manage/project/history.html:106
msgid "URL:"
@@ -4476,7 +4237,6 @@ msgid ""
"rel=\"noopener\">Python Packaging User Guide"
msgstr ""
-<<<<<<< HEAD
#: warehouse/templates/manage/account/publishing.html:27
#: warehouse/templates/manage/project/publishing.html:25
#, python-format
@@ -4487,30 +4247,19 @@ msgstr ""
#: warehouse/templates/manage/account/publishing.html:38
#: warehouse/templates/manage/account/publishing.html:140
+#: warehouse/templates/manage/account/publishing.html:198
msgid "PyPI Project Name"
msgstr ""
#: warehouse/templates/manage/account/publishing.html:43
#: warehouse/templates/manage/account/publishing.html:145
+#: warehouse/templates/manage/account/publishing.html:203
msgid "project name"
msgstr ""
#: warehouse/templates/manage/account/publishing.html:45
#: warehouse/templates/manage/account/publishing.html:147
-=======
-#: warehouse/templates/manage/account/publishing.html:32
-#: warehouse/templates/manage/account/publishing.html:128
-msgid "PyPI Project Name"
-msgstr ""
-
-#: warehouse/templates/manage/account/publishing.html:37
-#: warehouse/templates/manage/account/publishing.html:133
-msgid "project name"
-msgstr ""
-
-#: warehouse/templates/manage/account/publishing.html:39
-#: warehouse/templates/manage/account/publishing.html:135
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/account/publishing.html:205
msgid "The project (on PyPI) that will be created when this publisher is used"
msgstr ""
@@ -4586,13 +4335,9 @@ msgid ""
"commit access who shouldn't have PyPI publishing access."
msgstr ""
-<<<<<<< HEAD
#: warehouse/templates/manage/account/publishing.html:122
#: warehouse/templates/manage/account/publishing.html:186
-=======
-#: warehouse/templates/manage/account/publishing.html:116
-#: warehouse/templates/manage/account/publishing.html:187
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/account/publishing.html:257
#: warehouse/templates/manage/project/publishing.html:105
#: warehouse/templates/manage/project/publishing.html:154
#: warehouse/templates/manage/project/roles.html:320
@@ -4600,7 +4345,6 @@ msgstr ""
msgid "Add"
msgstr ""
-<<<<<<< HEAD
#: warehouse/templates/manage/account/publishing.html:129
#: warehouse/templates/manage/project/publishing.html:112
#, python-format
@@ -4632,116 +4376,86 @@ msgid ""
"identity used for publishing. More details here."
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:197
-msgid "Manage publishers"
-msgstr ""
-
-#: warehouse/templates/manage/account/publishing.html:207
-msgid "Project"
-msgstr ""
-
-=======
-#: warehouse/templates/manage/account/publishing.html:143
+#: warehouse/templates/manage/account/publishing.html:213
#: warehouse/templates/organizations/profile.html:30
msgid "Organization"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:148
+#: warehouse/templates/manage/account/publishing.html:218
msgid "my-organization"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:150
+#: warehouse/templates/manage/account/publishing.html:220
msgid "The ActiveState organization name that owns the project"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:158
+#: warehouse/templates/manage/account/publishing.html:228
msgid "ActiveState Project name"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:163
+#: warehouse/templates/manage/account/publishing.html:233
msgid "my-project"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:165
+#: warehouse/templates/manage/account/publishing.html:235
msgid "The ActiveState project that will build your Python artifact."
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:173
+#: warehouse/templates/manage/account/publishing.html:243
msgid "Actor Username"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:178
+#: warehouse/templates/manage/account/publishing.html:248
msgid "my-username"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:180
+#: warehouse/templates/manage/account/publishing.html:250
msgid "The ActiveState user that will trigger the build of your Python artifact."
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:197
+#: warehouse/templates/manage/account/publishing.html:268
msgid "Manage publishers"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:207
+#: warehouse/templates/manage/account/publishing.html:278
msgid "Project"
msgstr ""
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
-#: warehouse/templates/manage/account/publishing.html:229
+#: warehouse/templates/manage/account/publishing.html:300
msgid ""
"No publishers are currently configured. Publishers for existing projects "
"can be added in the publishing configuration for each individual project."
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:241
+#: warehouse/templates/manage/account/publishing.html:312
msgid "Pending project name"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:242
-<<<<<<< HEAD
+#: warehouse/templates/manage/account/publishing.html:313
#: warehouse/templates/manage/project/publishing.html:181
-=======
-#: warehouse/templates/manage/project/publishing.html:131
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
msgid "Publisher"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:243
-<<<<<<< HEAD
+#: warehouse/templates/manage/account/publishing.html:314
#: warehouse/templates/manage/project/publishing.html:182
-=======
-#: warehouse/templates/manage/project/publishing.html:132
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
msgid "Details"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:255
+#: warehouse/templates/manage/account/publishing.html:326
msgid ""
"No pending publishers are currently configured. Publishers for projects "
"that don't exist yet can be added below."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/templates/manage/account/publishing.html:263
-msgid "Add a new pending publisher"
-msgstr ""
-
-#: warehouse/templates/manage/account/publishing.html:266
-msgid "You can use this page to register \"pending\" trusted publishers."
-msgstr ""
-
-#: warehouse/templates/manage/account/publishing.html:272
-=======
-#: warehouse/templates/manage/account/publishing.html:261
+#: warehouse/templates/manage/account/publishing.html:334
msgid "Add a new pending publisher"
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:264
+#: warehouse/templates/manage/account/publishing.html:337
msgid "You can use this page to register \"pending\" trusted publishers."
msgstr ""
-#: warehouse/templates/manage/account/publishing.html:270
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
+#: warehouse/templates/manage/account/publishing.html:343
#, python-format
msgid ""
"These publishers behave similarly to trusted publishers registered "
@@ -4752,13 +4466,8 @@ msgid ""
"trusted publishers here."
msgstr ""
-<<<<<<< HEAD
-#: warehouse/templates/manage/account/publishing.html:310
+#: warehouse/templates/manage/account/publishing.html:382
#: warehouse/templates/manage/project/publishing.html:228
-=======
-#: warehouse/templates/manage/account/publishing.html:302
-#: warehouse/templates/manage/project/publishing.html:168
->>>>>>> 645bef701 (Add ActiveState OIDC Form)
#, python-format
msgid ""
"You must first enable two-factor authentication "
diff --git a/warehouse/oidc/forms/__init__.py b/warehouse/oidc/forms/__init__.py
index ba846d269444..c37d8e851b1d 100644
--- a/warehouse/oidc/forms/__init__.py
+++ b/warehouse/oidc/forms/__init__.py
@@ -11,12 +11,12 @@
# limitations under the License.
from warehouse.oidc.forms._core import DeletePublisherForm
-from warehouse.oidc.forms.github import GitHubPublisherForm, PendingGitHubPublisherForm
-from warehouse.oidc.forms.google import GooglePublisherForm, PendingGooglePublisherForm
from warehouse.oidc.forms.activestate import (
ActiveStatePublisherForm,
PendingActiveStatePublisherForm,
)
+from warehouse.oidc.forms.github import GitHubPublisherForm, PendingGitHubPublisherForm
+from warehouse.oidc.forms.google import GooglePublisherForm, PendingGooglePublisherForm
__all__ = [
"DeletePublisherForm",
diff --git a/warehouse/oidc/forms/activestate.py b/warehouse/oidc/forms/activestate.py
index c1402dacc203..cf27e0c4ad94 100644
--- a/warehouse/oidc/forms/activestate.py
+++ b/warehouse/oidc/forms/activestate.py
@@ -94,14 +94,14 @@ def _lookup_organization(self, org_url_name: str) -> None:
response.raise_for_status()
except requests.HTTPError:
sentry_sdk.capture_message(
- f"Unexpected error from ActiveState organization lookup: {response.content=}"
+ f"Unexpected error from ActiveState organization lookup: {response.content!r}" # noqa
)
raise wtforms.validators.ValidationError(
_("Unexpected error from ActiveState. Try again")
)
except requests.ConnectionError:
sentry_sdk.capture_message(
- "Connection error from ActiveState organization lookup API (possibly offline)"
+ "Connection error from ActiveState organization lookup API (possibly offline)" # noqa
)
raise wtforms.validators.ValidationError(
_(
@@ -136,7 +136,7 @@ def _lookup_organization(self, org_url_name: str) -> None:
)
except requests.exceptions.JSONDecodeError:
sentry_sdk.capture_message(
- f"Unexpected error from ActiveState organization lookup: {response.content=}"
+ f"Unexpected error from ActiveState organization lookup: {response.content!r}" # noqa
)
raise wtforms.validators.ValidationError(
_("Unexpected error from ActiveState. Try again")
@@ -160,7 +160,7 @@ def _lookup_actor(self, actor: str) -> UserResponse:
response.raise_for_status()
except requests.HTTPError:
sentry_sdk.capture_message(
- f"Unexpected error from ActiveState actor lookup: {response.content=}"
+ f"Unexpected error from ActiveState actor lookup: {response.content!r}"
)
raise wtforms.validators.ValidationError(
_("Unexpected error from ActiveState. Try again")
@@ -202,7 +202,7 @@ def _lookup_actor(self, actor: str) -> UserResponse:
)
except requests.exceptions.JSONDecodeError:
sentry_sdk.capture_message(
- f"Unexpected error from ActiveState actor lookup: {response.content=}"
+ f"Unexpected error from ActiveState actor lookup: {response.content!r}"
)
raise wtforms.validators.ValidationError(
_("Unexpected error from ActiveState. Try again")
diff --git a/warehouse/oidc/models/__init__.py b/warehouse/oidc/models/__init__.py
index 08ff5379e746..8417b6fd8ea8 100644
--- a/warehouse/oidc/models/__init__.py
+++ b/warehouse/oidc/models/__init__.py
@@ -17,10 +17,6 @@
)
from warehouse.oidc.models.github import GitHubPublisher, PendingGitHubPublisher
from warehouse.oidc.models.google import GooglePublisher, PendingGooglePublisher
-from warehouse.oidc.models.activestate import (
- ActiveStatePublisher,
- PendingActiveStatePublisher,
-)
__all__ = [
"OIDCPublisher",