Skip to content

Commit

Permalink
Make user facing error message indicate a more appropriate follow up …
Browse files Browse the repository at this point in the history
…action
  • Loading branch information
th3coop committed Feb 8, 2024
1 parent a791132 commit 52e8231
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 307 deletions.
10 changes: 5 additions & 5 deletions tests/unit/accounts/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,7 @@ def test_manage_publishing(self, metrics, monkeypatch):
},
"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, # noqa
"pending_activestate_publisher_form": pending_activestate_publisher_form_obj, # noqa: E501
}

assert request.flags.disallow_oidc.calls == [
Expand Down Expand Up @@ -3441,7 +3441,7 @@ def test_manage_publishing_admin_disabled(self, monkeypatch, pyramid_request):
},
"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, # noqa
"pending_activestate_publisher_form": pending_activestate_publisher_form_obj, # noqa: E501
}

assert pyramid_request.flags.disallow_oidc.calls == [
Expand Down Expand Up @@ -3543,7 +3543,7 @@ def test_add_pending_oidc_publisher_admin_disabled(
},
"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, # noqa
"pending_activestate_publisher_form": pending_activestate_publisher_form_obj, # noqa: E501
}

assert pyramid_request.flags.disallow_oidc.calls == [
Expand Down Expand Up @@ -3654,7 +3654,7 @@ def test_add_pending_oidc_publisher_user_cannot_register(
},
"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, # noqa
"pending_activestate_publisher_form": pending_activestate_publisher_form_obj, # noqa: E501
}

assert pyramid_request.flags.disallow_oidc.calls == [
Expand Down Expand Up @@ -4305,7 +4305,7 @@ def test_delete_pending_oidc_publisher_admin_disabled(
},
"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, # noqa
"pending_activestate_publisher_form": pending_activestate_publisher_form_obj, # noqa: E501
}

assert pyramid_request.flags.disallow_oidc.calls == [
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/oidc/forms/test_activestate.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_lookup_actor_404(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa: E501
"variables": {"username": fake_username},
},
timeout=5,
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_lookup_actor_other_http_error(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa: E501
"variables": {"username": fake_username},
},
timeout=5,
Expand Down Expand Up @@ -244,7 +244,7 @@ def test_lookup_actor_gql_error(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa: E501
"variables": {"username": fake_username},
},
timeout=5,
Expand Down Expand Up @@ -275,7 +275,7 @@ def test_lookup_actor_gql_no_data(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa: E501
"variables": {"username": fake_username},
},
timeout=5,
Expand Down Expand Up @@ -304,7 +304,7 @@ def test_lookup_actor_succeeds(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa
"query": "query($username: String) {users(where: {username: {_eq: $username}}) {user_id}}", # noqa: E501
"variables": {"username": fake_username},
},
timeout=5,
Expand Down Expand Up @@ -337,7 +337,7 @@ def test_lookup_organization_404(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa: E501
"variables": {"orgname": fake_org_name},
},
timeout=5,
Expand Down Expand Up @@ -371,7 +371,7 @@ def test_lookup_organization_other_http_error(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa: E501
"variables": {"orgname": fake_org_name},
},
timeout=5,
Expand Down Expand Up @@ -474,7 +474,7 @@ def test_lookup_organization_gql_error(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa: E501
"variables": {"orgname": fake_org_name},
},
timeout=5,
Expand Down Expand Up @@ -506,7 +506,7 @@ def test_lookup_organization_gql_no_data(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa: E501
"variables": {"orgname": fake_org_name},
},
timeout=5,
Expand All @@ -530,7 +530,7 @@ def test_lookup_organization_succeeds(self, monkeypatch):
pretend.call(
"https://platform.activestate.com/graphql/v1/graphql",
json={
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa
"query": "query($orgname: String) {organizations(where: {display_name: {_eq: $orgname}}) {added}}", # noqa: E501
"variables": {"orgname": fake_org_name},
},
timeout=5,
Expand Down
2 changes: 1 addition & 1 deletion warehouse/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, # noqa
"pending_activestate_publisher_form": self.pending_activestate_publisher_form, # noqa: E501
"disabled": {
"GitHub": self.request.flags.disallow_oidc(
AdminFlagValue.DISALLOW_GITHUB_OIDC
Expand Down
Loading

0 comments on commit 52e8231

Please sign in to comment.