Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sentry/integrations/vercel/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def create_env_var(self, client, vercel_project_id, key, value, type):
data = {
"key": key,
"value": value,
"target": ["production"],
"target": ["production", "preview", "development"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this a constant or ENUM?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, this is the only place where we need it in this file and I think it is okay to make it explicit like this.

We could, of course, make a constant out of this, and then share this constant with our test in test_integration.py but :) :

  1. I don't know Python that much
  2. I don't know if that is a good practice to assert against a variable that is constant in code

"type": type,
}
try:
Expand Down
24 changes: 12 additions & 12 deletions tests/sentry/integrations/vercel/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_update_organization_config(self):
json={
"key": env_var,
"value": details["value"],
"target": ["production"],
"target": ["production", "preview", "development"],
"type": details["type"],
},
)
Expand All @@ -192,30 +192,30 @@ def test_update_organization_config(self):
req_params = json.loads(responses.calls[5].request.body)
assert req_params["key"] == "SENTRY_ORG"
assert req_params["value"] == org.slug
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[6].request.body)
assert req_params["key"] == "SENTRY_PROJECT"
assert req_params["value"] == self.project.slug
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[7].request.body)
assert req_params["key"] == "NEXT_PUBLIC_SENTRY_DSN"
assert req_params["value"] == enabled_dsn
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[8].request.body)
assert req_params["key"] == "SENTRY_AUTH_TOKEN"
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[9].request.body)
assert req_params["key"] == "VERCEL_GIT_COMMIT_SHA"
assert req_params["value"] == "VERCEL_GIT_COMMIT_SHA"
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "system"

@responses.activate
Expand Down Expand Up @@ -270,7 +270,7 @@ def test_update_org_config_vars_exist(self):
json={
"key": env_var,
"value": details["value"],
"target": ["production"],
"target": ["production", "preview", "development"],
"type": details["type"],
},
)
Expand All @@ -292,30 +292,30 @@ def test_update_org_config_vars_exist(self):
req_params = json.loads(responses.calls[5].request.body)
assert req_params["key"] == "SENTRY_ORG"
assert req_params["value"] == org.slug
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[8].request.body)
assert req_params["key"] == "SENTRY_PROJECT"
assert req_params["value"] == self.project.slug
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[11].request.body)
assert req_params["key"] == "SENTRY_DSN"
assert req_params["value"] == enabled_dsn
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[14].request.body)
assert req_params["key"] == "SENTRY_AUTH_TOKEN"
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "encrypted"

req_params = json.loads(responses.calls[17].request.body)
assert req_params["key"] == "VERCEL_GIT_COMMIT_SHA"
assert req_params["value"] == "VERCEL_GIT_COMMIT_SHA"
assert req_params["target"] == ["production"]
assert req_params["target"] == ["production", "preview", "development"]
assert req_params["type"] == "system"

@responses.activate
Expand Down