edx-ace 1.10.1__py2.py3-none-any.whl → 1.11.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
edx_ace/__init__.py CHANGED
@@ -13,7 +13,7 @@ from .policy import Policy, PolicyResult
13
13
  from .recipient import Recipient
14
14
  from .recipient_resolver import RecipientResolver
15
15
 
16
- __version__ = '1.10.1'
16
+ __version__ = '1.11.1'
17
17
 
18
18
 
19
19
  __all__ = [
edx_ace/delivery.py CHANGED
@@ -10,6 +10,7 @@ import time
10
10
  from django.conf import settings
11
11
 
12
12
  from edx_ace.errors import RecoverableChannelDeliveryError
13
+ from edx_ace.signals import ACE_MESSAGE_SENT
13
14
  from edx_ace.utils.date import get_current_time
14
15
 
15
16
  LOG = logging.getLogger(__name__)
@@ -60,6 +61,7 @@ def deliver(channel, rendered_message, message):
60
61
  message.report(f'{channel_type}_delivery_retried', num_seconds)
61
62
  else:
62
63
  message.report(f'{channel_type}_delivery_succeeded', True)
64
+ ACE_MESSAGE_SENT.send(sender=channel, message=message)
63
65
  return
64
66
 
65
67
  delivery_expired_report = f'{channel_type}_delivery_expired'
edx_ace/signals.py ADDED
@@ -0,0 +1,7 @@
1
+ """
2
+ Signals for the edx_ace app
3
+ """
4
+ from django.dispatch import Signal
5
+
6
+ # signal to indicate that a message has been sent using ace
7
+ ACE_MESSAGE_SENT = Signal()
@@ -34,21 +34,26 @@ class TestDelivery(TestCase): # pylint: disable=missing-class-docstring
34
34
  )
35
35
  self.current_time = datetime.datetime.utcnow().replace(tzinfo=tzutc())
36
36
 
37
- def test_happy_path(self):
37
+ @patch('edx_ace.delivery.ACE_MESSAGE_SENT.send')
38
+ def test_happy_path(self, mock_ace_message_sent):
38
39
  deliver(self.mock_channel, sentinel.rendered_email, self.message)
39
40
  self.mock_channel.deliver.assert_called_once_with(self.message, sentinel.rendered_email)
41
+ # check if ACE_MESSAGE_SENT is raised
42
+ mock_ace_message_sent.assert_called_once_with(sender=self.mock_channel, message=self.message)
40
43
 
41
44
  def test_fatal_error(self):
42
45
  self.mock_channel.deliver.side_effect = FatalChannelDeliveryError('testing')
43
46
  with self.assertRaises(FatalChannelDeliveryError):
44
47
  deliver(self.mock_channel, sentinel.rendered_email, self.message)
45
48
 
49
+ @patch('edx_ace.delivery.ACE_MESSAGE_SENT.send')
46
50
  @patch('edx_ace.delivery.get_current_time')
47
- def test_custom_message_expiration(self, mock_get_current_time):
51
+ def test_custom_message_expiration(self, mock_get_current_time, mock_ace_message_sent):
48
52
  self.message.expiration_time = self.current_time - datetime.timedelta(seconds=10)
49
53
  mock_get_current_time.return_value = self.current_time
50
54
  deliver(self.mock_channel, sentinel.rendered_email, self.message)
51
55
  assert not self.mock_channel.deliver.called
56
+ mock_ace_message_sent.assert_not_called()
52
57
 
53
58
  @patch('edx_ace.delivery.time')
54
59
  @patch('edx_ace.delivery.get_current_time')
@@ -100,3 +105,16 @@ class TestDelivery(TestCase): # pylint: disable=missing-class-docstring
100
105
  deliver(self.mock_channel, sentinel.rendered_email, self.message)
101
106
  assert mock_time.sleep.call_args_list == [call(1), call(1)]
102
107
  assert self.mock_channel.deliver.call_count == 3
108
+
109
+ @patch('edx_ace.delivery.ACE_MESSAGE_SENT.send')
110
+ def test_message_sent_signal_for_push_channel(self, mock_ace_message_sent):
111
+ """
112
+ Test that ACE_MESSAGE_SENT signal is sent when a message is delivered to a push channel.
113
+ """
114
+ mock_push_channel = Mock(
115
+ name='push_channel',
116
+ channel_type=ChannelType.PUSH
117
+ )
118
+ deliver(mock_push_channel, sentinel.rendered_email, self.message)
119
+ # check if ACE_MESSAGE_SENT is raised
120
+ mock_ace_message_sent.assert_called_once_with(sender=mock_push_channel, message=self.message)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edx-ace
3
- Version: 1.10.1
3
+ Version: 1.11.1
4
4
  Summary: Framework for Messaging
5
5
  Home-page: https://github.com/openedx/edx-ace
6
6
  Author: edX
@@ -18,19 +18,19 @@ Classifier: Programming Language :: Python :: 3
18
18
  Classifier: Programming Language :: Python :: 3.8
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Description-Content-Type: text/x-rst
21
- Requires-Dist: Django >=2.2
22
- Requires-Dist: attrs >=17.2.0
21
+ Requires-Dist: Django>=2.2
22
+ Requires-Dist: attrs>=17.2.0
23
23
  Requires-Dist: django-push-notifications
24
- Requires-Dist: edx-django-utils >=5.14.2
24
+ Requires-Dist: edx-django-utils>=5.14.2
25
25
  Requires-Dist: firebase-admin
26
26
  Requires-Dist: python-dateutil
27
- Requires-Dist: sailthru-client ==2.2.3
27
+ Requires-Dist: sailthru-client==2.2.3
28
28
  Requires-Dist: six
29
- Requires-Dist: stevedore >=1.10.0
29
+ Requires-Dist: stevedore>=1.10.0
30
30
  Provides-Extra: push_notifications
31
- Requires-Dist: django-push-notifications[fcm] ; extra == 'push_notifications'
31
+ Requires-Dist: django-push-notifications[fcm]; extra == "push-notifications"
32
32
  Provides-Extra: sailthru
33
- Requires-Dist: sailthru-client <2.3,>2.2 ; extra == 'sailthru'
33
+ Requires-Dist: sailthru-client<2.3,>2.2; extra == "sailthru"
34
34
 
35
35
  edX Automated Communication Engine (A.C.E.)
36
36
  ###########################################
@@ -1,7 +1,7 @@
1
- edx_ace/__init__.py,sha256=BEI_2W_-VD3LcjFTXuez9y9Mk05167aQI7kLCvVbvFs,636
1
+ edx_ace/__init__.py,sha256=NNRZBB6kXsBqSeXn-kM6K_JUeSKuKmsOrDq7zJFW1ec,636
2
2
  edx_ace/ace.py,sha256=0nP8zvIWiME4qmpMT1PaV4nRDG6YR9Dxm7A6FGoBa8I,2501
3
3
  edx_ace/apps.py,sha256=xNedkdW6TNpm-W1uxnj3Vre2R1akkh2n_7DkSfKXmAk,216
4
- edx_ace/delivery.py,sha256=Tjc3GKubPaDsbKiBXO2jQBz9ursJ3nb7ZgZNSEeuqWQ,2690
4
+ edx_ace/delivery.py,sha256=m_IOo4HTuuMZ61OOBZCA_TgLcfrME8BidWDutJmnaY0,2802
5
5
  edx_ace/errors.py,sha256=y0MqT55qXLkpn_r5LVhHcYuU2-zHs56CQTAbNCqb72k,1065
6
6
  edx_ace/message.py,sha256=lhmPor9vnaLvC4NPyRgB-obpGjGv9Lni0obcOUTgyCg,8340
7
7
  edx_ace/monitoring.py,sha256=6nEcAJMCr9keCTJw9JjGecTg_J1ubcGJfuGiFq2B8G4,257
@@ -11,6 +11,7 @@ edx_ace/recipient.py,sha256=ogZjjKorAc6yiqvcnXcAMsHz2uAfhYU5qLPUoifofXQ,576
11
11
  edx_ace/recipient_resolver.py,sha256=ChY0cgLSt_HioKSHyuCh7iHSJOsBWuivsOvAc6QyedE,959
12
12
  edx_ace/renderers.py,sha256=eJcTWyRhny-3PLHDV4Rozk1TJ0fjsqgOcFOWO_TTngk,3143
13
13
  edx_ace/serialization.py,sha256=EptnQqbI9j5kVqdUDAlm2pcm3dUsFwsP9tAji3y5uqc,3775
14
+ edx_ace/signals.py,sha256=7kwpw7SgpPP6TRTtTQeGEOZ2cD_AcD4sSrpVxd_a19w,160
14
15
  edx_ace/channel/__init__.py,sha256=l2qZdiQb2HFsMixWjqf50-si7aGr06M2MvEYc7XayjU,6890
15
16
  edx_ace/channel/braze.py,sha256=k-R9jZpiBQTV0FQ3Z2gOipVgxNpBMPSLBL71muh9go4,10240
16
17
  edx_ace/channel/django_email.py,sha256=9TNdiFJ2U3QjKEriUl3_9twAFkH-E2EmrWujStUOWN0,2174
@@ -23,7 +24,7 @@ edx_ace/templatetags/acetags.py,sha256=CFVLb1j7oCN0mNNOpjaUHqQBEGlYZyRUgbYr9vS-S
23
24
  edx_ace/test_utils/__init__.py,sha256=HfJqvOqVNFS0dMpj4TnnXrTWHO8nutRFdA1Qja7ktfY,1087
24
25
  edx_ace/tests/test_ace.py,sha256=H5ss4ah-v5XDJ47udl6Ob6iSVdcX0qkjPI2h0kgWp1k,3278
25
26
  edx_ace/tests/test_date.py,sha256=RteoiCrc269BXnIerrtz8I0K1weldZ_Qg9Oc0Nd8ixs,639
26
- edx_ace/tests/test_delivery.py,sha256=2y65-C3ED0A2j-pA553LWvSwNHNeio8h28JKQKrxi74,4850
27
+ edx_ace/tests/test_delivery.py,sha256=0NYvFRWWcbEIdv5LE17EdYYcf9SE5g7mspC8poqPpNQ,5796
27
28
  edx_ace/tests/test_message.py,sha256=uAf3XltW605WieNGdi0u5p6bY_oSqLsmV5pHU3J_TiQ,4430
28
29
  edx_ace/tests/test_policy.py,sha256=T6Mm_q1Bi935WMBPS7sK5XbXM5izQ3y0KW0yiaQ5_GU,1597
29
30
  edx_ace/tests/test_presentation.py,sha256=elgVz_sR04h3KKs73G0qQBzt0CazOPWKrDF2rVC_R4U,541
@@ -39,9 +40,9 @@ edx_ace/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
40
  edx_ace/utils/date.py,sha256=Rmz3RAUCdd30hu1qcKH7FmAypaw1aSoZg-yfZig1c8A,1483
40
41
  edx_ace/utils/once.py,sha256=sY3szBh3gvvAjrKbKq4S2mCejompjh5YcYD7XOhzjGU,2024
41
42
  edx_ace/utils/plugins.py,sha256=U-l-eU2uWUiiwYV-H-2DfmwjoksqskAsYwS7QnThy2Q,2090
42
- edx_ace-1.10.1.dist-info/LICENSE.txt,sha256=VrSJ4gO4NCpskzfNHbaTB4VcN9Q213YdcHbpOZSwcOA,35138
43
- edx_ace-1.10.1.dist-info/METADATA,sha256=U9p9FHLUjRfe1d8AjDfeIx0l5kshf10SToG_82-mAfo,10114
44
- edx_ace-1.10.1.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
45
- edx_ace-1.10.1.dist-info/entry_points.txt,sha256=fiR8u0PqGyp2qIiJxcSrYhIZ3gEwl0vIMnTPWegXwRI,332
46
- edx_ace-1.10.1.dist-info/top_level.txt,sha256=5eg_80KI88VkeiCVqZUqcYcc_PfPOg8o1GA4HxsiRU8,8
47
- edx_ace-1.10.1.dist-info/RECORD,,
43
+ edx_ace-1.11.1.dist-info/LICENSE.txt,sha256=VrSJ4gO4NCpskzfNHbaTB4VcN9Q213YdcHbpOZSwcOA,35138
44
+ edx_ace-1.11.1.dist-info/METADATA,sha256=eTDhK8s6zluZDzmrBoanH8CN3hoVOqyVr8igrUydmi0,10106
45
+ edx_ace-1.11.1.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
46
+ edx_ace-1.11.1.dist-info/entry_points.txt,sha256=fiR8u0PqGyp2qIiJxcSrYhIZ3gEwl0vIMnTPWegXwRI,332
47
+ edx_ace-1.11.1.dist-info/top_level.txt,sha256=5eg_80KI88VkeiCVqZUqcYcc_PfPOg8o1GA4HxsiRU8,8
48
+ edx_ace-1.11.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any