示例#1
0
    def test_notify_event(self):
        couch_user = Mock()
        couch_user._id = '123'
        couch_user.username = '******'
        with patch('corehq.apps.app_manager.views.notifications.RedisMessage'), \
                patch('corehq.apps.app_manager.views.notifications.RedisPublisher'), \
                patch('corehq.apps.app_manager.views.notifications.json_format_datetime') as format_patch, \
                patch('corehq.apps.app_manager.views.notifications.json') as json_patch:
            format_patch.return_value = 'maintenant'

            message = u'Émilie, vous avez de nouveaux messages.'
            notify_event('domain', couch_user, 'app_id', 'unique_form_id',
                         message)

            notification = (
                u'Émilie, vous avez de nouveaux messages. (<a href="https://confluence.dimagi.com/'
                u'display/internal/App+Builder+Notifications" target="_blank">what is this?</a>)'
            )
            json_patch.dumps.assert_called_with({
                'domain': 'domain',
                'user_id': '123',
                'username': '******',
                'text': notification,
                'timestamp': 'maintenant',
            })
示例#2
0
    def test_notify_event(self):
        couch_user = Mock()
        couch_user._id = '123'
        couch_user.username = '******'
        with patch('corehq.apps.app_manager.views.notifications.RedisMessage'), \
                patch('corehq.apps.app_manager.views.notifications.RedisPublisher'), \
                patch('corehq.apps.app_manager.views.notifications.json_format_datetime') as format_patch, \
                patch('corehq.apps.app_manager.views.notifications.json') as json_patch:
            format_patch.return_value = 'maintenant'

            message = 'Émilie, vous avez de nouveaux messages.'
            notify_event('domain', couch_user, 'app_id', 'form_unique_id', message)

            notification = ('Émilie, vous avez de nouveaux messages.')
            json_patch.dumps.assert_called_with({
                'domain': 'domain',
                'user_id': '123',
                'username': '******',
                'text': notification,
                'timestamp': 'maintenant',
            })
示例#3
0
    def test_notify_event(self):
        couch_user = Mock()
        couch_user._id = '123'
        couch_user.username = '******'
        with patch('corehq.apps.app_manager.views.notifications.RedisMessage'), \
                patch('corehq.apps.app_manager.views.notifications.RedisPublisher'), \
                patch('corehq.apps.app_manager.views.notifications.json_format_datetime') as format_patch, \
                patch('corehq.apps.app_manager.views.notifications.json') as json_patch:
            format_patch.return_value = 'maintenant'

            message = 'Émilie, vous avez de nouveaux messages.'
            notify_event('domain', couch_user, 'app_id', 'form_unique_id', message)

            notification = ('Émilie, vous avez de nouveaux messages.')
            json_patch.dumps.assert_called_with({
                'domain': 'domain',
                'user_id': '123',
                'username': '******',
                'text': notification,
                'timestamp': 'maintenant',
            })