-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
chore(notif-platform): More utility on NotificationProvider #93562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
leeandher
merged 10 commits into
master
from
leander/eco-710-implement-a-base-notificationtarget
Jun 18, 2025
Merged
chore(notif-platform): More utility on NotificationProvider #93562
leeandher
merged 10 commits into
master
from
leander/eco-710-implement-a-base-notificationtarget
Jun 18, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e51544f
to
77da153
Compare
leeandher
commented
Jun 13, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #93562 +/- ##
==========================================
+ Coverage 85.65% 88.03% +2.38%
==========================================
Files 10331 10336 +5
Lines 596435 596434 -1
Branches 23161 23124 -37
==========================================
+ Hits 510869 525088 +14219
+ Misses 85107 70853 -14254
- Partials 459 493 +34 |
Comment on lines
7
to
22
) | ||
from sentry.testutils.cases import TestCase | ||
|
||
|
||
class DiscordRendererTest(TestCase): | ||
def test_default_renderer(self): | ||
renderer = DiscordNotificationProvider.get_renderer(type=NotificationType.DEBUG) | ||
assert renderer.render(data={}, template={}) == {} | ||
|
||
|
||
class DiscordNotificationProviderTest(TestCase): | ||
def test_basic_fields(self): | ||
provider = DiscordNotificationProvider() | ||
assert provider.key == NotificationProviderKey.DISCORD | ||
assert provider.target_class == IntegrationNotificationTarget | ||
assert provider.target_resource_types == [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏼
8b67558
to
8664528
Compare
GabeVillalobos
approved these changes
Jun 18, 2025
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jun 19, 2025
Adds a few things to NotificationProvider - get_renderer() -> uses the default renderer by default - target_class -> must be a subclass of `NotificationTarget`, added a test for this - target_resource_types -> a list of valid resources that this provider can consume - validate_target -> a method for the eventual NotificationService to validate the incoming target The NotificationTarget classes are dataclasses with their own validation. Even though it's a side-effect, I think it's reasonable to prevent initializing a dataclass which will produce an error if used, though I added a todo about a making needless RPC calls All of the validation has added tests, and the renderers/providers being stubbed out have also been expanded.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a few things to NotificationProvider
NotificationTarget
, added a test for thisThe NotificationTarget classes are dataclasses with their own validation. Even though it's a side-effect, I think it's reasonable to prevent initializing a dataclass which will produce an error if used, though I added a todo about a making needless RPC calls
All of the validation has added tests, and the renderers/providers being stubbed out have also been expanded.