-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix timezone test and remove duplicated tests
- Loading branch information
1 parent
b75e5c6
commit 4c52d9f
Showing
5 changed files
with
4 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +0,0 @@ | ||
import os | ||
from unittest import skipUnless | ||
|
||
import swapper | ||
from django.contrib.auth import get_user_model | ||
|
||
from notifications.signals import notify | ||
from notifications.tests.tests import AdminTest as BaseAdminTest | ||
from notifications.tests.tests import NotificationTest as BaseNotificationTest | ||
|
||
Notification = swapper.load_model("notifications", "Notification") | ||
User = get_user_model() | ||
|
||
|
||
@skipUnless(os.environ.get("SAMPLE_APP", False), "Running tests on standard django-notifications models") | ||
class AdminTest(BaseAdminTest): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
BaseAdminTest.app_name = "sample_notifications" | ||
|
||
|
||
@skipUnless(os.environ.get("SAMPLE_APP", False), "Running tests on standard django-notifications models") | ||
class NotificationTest(BaseNotificationTest): | ||
pass | ||
|
||
|
||
class TestExtraDataCustomAccessor(NotificationTest): | ||
def setUp(self): | ||
self.from_user = User.objects.create_user(username="from_extra", password="pwd", email="example@example.com") | ||
self.to_user = User.objects.create_user(username="to_extra", password="pwd", email="example@example.com") | ||
notify.send( | ||
self.from_user, | ||
recipient=self.to_user, | ||
verb="commented", | ||
action_object=self.from_user, | ||
url="/learn/ask-a-pro/q/test-question-9/299/", | ||
other_content="Hello my 'world'", | ||
details="test detail", | ||
) | ||
|
||
def test_extra_data(self): | ||
notification = Notification.objects.get(details="test detail") | ||
assert notification, "Expected a notification retrieved by custom extra data accessor" | ||
assert notification.details == "test detail", "Custom accessor should return set value" | ||
assert "details" not in notification.data, "Custom accessor should not be in json data" | ||
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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