コード例 #1
0
ファイル: test_alert.py プロジェクト: sandip3120/private
 def test_alert_confirmation_uses_dispatcher(self, mock_dispatch):
     alert = ProductAlert.objects.create(email='*****@*****.**',
                                         key='dummykey',
                                         status=ProductAlert.UNCONFIRMED,
                                         product=self.product)
     send_alert_confirmation(alert)
     self.assertEqual(mock_dispatch.call_count, 1)
     self.assertEqual(mock_dispatch.call_args[0][0], '*****@*****.**')
コード例 #2
0
ファイル: test_alert.py プロジェクト: ibrmora/django-oscar
 def test_alert_confirmation_uses_dispatcher(self, mock_dispatch):
     alert = ProductAlert.objects.create(
         email='*****@*****.**',
         key='dummykey',
         status=ProductAlert.UNCONFIRMED,
         product=self.product
     )
     send_alert_confirmation(alert)
     self.assertEqual(mock_dispatch.call_count, 1)
     self.assertEqual(mock_dispatch.call_args[0][0], '*****@*****.**')
コード例 #3
0
    def test_deprecated_notification_templates_work(self, mock_loader):
        """
        This test can be removed when support for the deprecated templates is
        dropped.
        """
        mock_loader.side_effect = self._load_deprecated_template
        with warnings.catch_warnings(record=True) as warning_list:
            warnings.simplefilter("always")

            alert = ProductAlert.objects.create(
                email='*****@*****.**',
                key='dummykey',
                status=ProductAlert.UNCONFIRMED,
                product=self.product)
            send_alert_confirmation(alert)
            # Check that warnings were raised
            self.assertTrue(
                any(item.category == RemovedInOscar20Warning
                    for item in warning_list))
            # Check that alerts were still sent
            self.assertEqual(len(mail.outbox), 1)
コード例 #4
0
ファイル: test_alert.py プロジェクト: ibrmora/django-oscar
    def test_deprecated_notification_templates_work(self, mock_loader):
        """
        This test can be removed when support for the deprecated templates is
        dropped.
        """
        mock_loader.side_effect = self._load_deprecated_template
        with warnings.catch_warnings(record=True) as warning_list:
            warnings.simplefilter("always")

            alert = ProductAlert.objects.create(
                email='*****@*****.**',
                key='dummykey',
                status=ProductAlert.UNCONFIRMED,
                product=self.product
            )
            send_alert_confirmation(alert)
            # Check that warnings were raised
            self.assertTrue(any(item.category == RemovedInOscar20Warning
                                                    for item in warning_list))
            # Check that alerts were still sent
            self.assertEqual(len(mail.outbox), 1)
コード例 #5
0
ファイル: views.py プロジェクト: AaronJaramillo/shopDPM
 def form_valid(self, form):
     response = super(ProductAlertCreateView, self).form_valid(form)
     if self.object.is_anonymous:
         utils.send_alert_confirmation(self.object)
     return response
コード例 #6
0
ファイル: views.py プロジェクト: iicc/django-oscar
 def form_valid(self, form):
     response = super().form_valid(form)
     if self.object.is_anonymous:
         utils.send_alert_confirmation(self.object)
     return response
コード例 #7
0
 def form_valid(self, form):
     response = super().form_valid(form)
     if self.object.is_anonymous:
         utils.send_alert_confirmation(self.object)
     return response
コード例 #8
0
ファイル: views.py プロジェクト: sharmapradeep/django-oscar
 def form_valid(self, form):
     response = super(ProductAlertCreateView, self).form_valid(form)
     if self.object.is_anonymous:
         utils.send_alert_confirmation(self.object)
     return response