Skip to content

Commit

Permalink
ref: remove unused add_notification_referrer_param
Browse files Browse the repository at this point in the history
introduced in 89742db but never called
  • Loading branch information
asottile-sentry committed Jan 16, 2025
1 parent 5078d05 commit 8b99d37
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
13 changes: 0 additions & 13 deletions src/sentry/plugins/bases/notify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
from urllib.error import HTTPError as UrllibHTTPError
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse

from django import forms
from requests.exceptions import HTTPError, SSLError
Expand Down Expand Up @@ -186,15 +185,3 @@ def test_configuration_and_get_test_results(self, project):
else:
test_results = "No errors returned"
return test_results

def add_notification_referrer_param(self, url):
if self.slug:
parsed_url = urlparse(url)
query = parse_qs(parsed_url.query)
query["referrer"] = self.slug

url_list = list(parsed_url)
url_list[4] = urlencode(query, doseq=True)
return urlunparse(url_list)

return url
22 changes: 0 additions & 22 deletions tests/sentry/plugins/bases/test_notify.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from unittest import mock
from urllib.parse import parse_qs, urlparse

from requests.exceptions import HTTPError, SSLError

Expand All @@ -20,27 +19,6 @@ def is_configured(self, project) -> bool:


class NotifyPluginTest(TestCase):
def test_add_notification_referrer_param(self):
n = DummyNotificationPlugin()
n.slug = "slack"
url = "https://sentry.io/"
assert n.add_notification_referrer_param(url) == url + "?referrer=" + n.slug

url = "https://sentry.io/?referrer=notslack"
assert n.add_notification_referrer_param(url) == "https://sentry.io/?referrer=slack"

url = "https://sentry.io/?utm_source=google"
with_referrer = n.add_notification_referrer_param(url)

# XXX(py3): Handle ordering differences between py2/3
assert parse_qs(urlparse(with_referrer).query) == parse_qs(
"referrer=slack&utm_source=google"
)

n.slug = ""
url = "https://sentry.io/"
assert n.add_notification_referrer_param(url) == "https://sentry.io/"

def test_notify_failure(self):
errors = (
ApiError("The server is sad"),
Expand Down

0 comments on commit 8b99d37

Please sign in to comment.