Skip to content

Commit d9aa859

Browse files
committed
feature/add_internal_notification_filters: added tests for notification filters.
1 parent 1f6c065 commit d9aa859

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
from bunq.sdk.context.bunq_context import BunqContext
2+
from bunq.sdk.model.core.notification_filter_push_user_internal import NotificationFilterPushUserInternal
3+
from bunq.sdk.model.core.notification_filter_url_monetary_account_internal import \
4+
NotificationFilterUrlMonetaryAccountInternal
5+
from bunq.sdk.model.core.notification_filter_url_user_internal import NotificationFilterUrlUserInternal
6+
from bunq.sdk.model.generated.object_ import NotificationFilterUrl, NotificationFilterPush
7+
from tests.bunq_test import BunqSdkTestCase
8+
9+
10+
class TestNotificationFilter(BunqSdkTestCase):
11+
_FILTER_CATEGORY_MUTATION = 'MUTATION'
12+
_FILTER_CALLBACK_URL = 'https://test.com/callback'
13+
14+
def test_notification_filter_url_monetary_account(self):
15+
notification_filter = self.get_notification_filter_url()
16+
all_notification_filter = [notification_filter]
17+
18+
all_created_notification_filter = NotificationFilterUrlMonetaryAccountInternal.create_with_list_response(
19+
self.get_primary_monetary_account().id_,
20+
all_notification_filter
21+
).value
22+
23+
self.assertEqual(1, len(all_created_notification_filter))
24+
25+
def test_notification_filter_url_user(self):
26+
notification_filter = self.get_notification_filter_url()
27+
all_notification_filter = [notification_filter]
28+
29+
all_created_notification_filter = NotificationFilterUrlUserInternal.create_with_list_response(
30+
all_notification_filter
31+
).value
32+
33+
self.assertEqual(1, len(all_created_notification_filter))
34+
35+
def test_notification_filter_push_user(self):
36+
notification_filter = self.get_notification_filter_push()
37+
all_notification_filter = [notification_filter]
38+
39+
all_created_notification_filter = NotificationFilterPushUserInternal.create_with_list_response(
40+
all_notification_filter
41+
).value
42+
43+
self.assertEqual(1, len(all_created_notification_filter))
44+
45+
def test_notification_filter_clear(self):
46+
all_created_notification_filter_push_user = \
47+
NotificationFilterPushUserInternal.create_with_list_response().value
48+
all_created_notification_filter_url_user = \
49+
NotificationFilterUrlUserInternal.create_with_list_response().value
50+
all_created_notification_filter_url_monetary_account = \
51+
NotificationFilterUrlMonetaryAccountInternal.create_with_list_response().value
52+
53+
self.assertTrue(all_created_notification_filter_push_user)
54+
self.assertTrue(all_created_notification_filter_url_user)
55+
self.assertTrue(all_created_notification_filter_url_monetary_account)
56+
57+
self.assertEqual(0, len(NotificationFilterPushUserInternal.list().value))
58+
self.assertEqual(0, len(NotificationFilterUrlUserInternal.list().value))
59+
self.assertEqual(0, len(NotificationFilterUrlMonetaryAccountInternal.list().value))
60+
61+
def get_notification_filter_url(self):
62+
return NotificationFilterUrl(self._FILTER_CATEGORY_MUTATION, self._FILTER_CALLBACK_URL)
63+
64+
def get_notification_filter_push(self):
65+
return NotificationFilterPush(self._FILTER_CATEGORY_MUTATION)
66+
67+
@staticmethod
68+
def get_primary_monetary_account():
69+
return BunqContext.user_context().primary_monetary_account

0 commit comments

Comments
 (0)