def test_note_form_sent_email(mock_send_note_confirmation, order_with_lines_and_stock): order = order_with_lines_and_stock note = OrderNote(order=order, user=order.user) form = OrderNoteForm({'content': 'test_note'}, instance=note) form.send_confirmation_email() assert mock_send_note_confirmation.called_once()
def test_note_form_sent_email(monkeypatch, order_with_lines): mock_send_mail = Mock(return_value=None) monkeypatch.setattr('saleor.dashboard.order.forms.send_note_confirmation', mock_send_mail) note = OrderNote(order=order_with_lines, user=order_with_lines.user) form = OrderNoteForm({'content': 'test_note'}, instance=note) form.send_confirmation_email() assert mock_send_mail.called_once()
def test_webhooks(billing_address, customer_user, order: Order): mocked = DummyAdapter.send = MagicMock(wraps=DummyAdapter.send) to_hook = ( Order(billing_address=billing_address, user=customer_user, user_email=customer_user.email, total=Price(123, currency='USD')), User(email='*****@*****.**', password='******'), OrderNote(order=order, user=customer_user), ) for hook in to_hook: mocked.reset_mock() hook.save() embed = hook.webhook_embed(True).to_dict() DummyAdapter.send.assert_called_once_with(embed=embed)