title: using mock on djstripe signal
body: <p>im having trouble mocking a djstripe web hook signal. The signal in question is: </p>
  
  <p>@webhooks.handler("charge.dispute.created")</p>
  
  <p>I need to mock this signal being sent so i can test the following method. I use this signal to notify administration that a dispute has been raised.</p>
  
  <p>Here is a link to the page on github that contains djstripes signal code:</p>
  
  <p><a href="https://github.com/dj-stripe/dj-stripe/blob/master/djstripe/signals.py" rel="nofollow noreferrer">https://github.com/dj-stripe/dj-stripe/blob/master/djstripe/signals.py</a></p>
  
  <p>Here is the method used on the djstripe handler</p>
  
  <pre><code>@webhooks.handler("charge.dispute.created")
  def charge_dispute_created(event, **kwargs):
      print(event)
      details = event.data.get("object")
      charge_id = details['charge']   
      charge = stripe.Charge.retrieve(
          charge_id,)
      order_pk = charge['metadata']['order']
      buyer_email = charge['metadata']['buyer']
      buyer = User.objects.get(email=buyer_email)
      seller_email = charge['metadata']['seller']
      seller = User.objects.get(email=seller_email)
      order = Order.objects.get(pk=order_pk)
      payment_intent = details['id']
  
  
              #send notification to buyer via notification and email
      notify.send(sender=order.advert, recipient=buyer, verb=' - A dispute has been raised on this listing due to the payment being flagged. Please contact customer support.',
          action_object=order)
  
      send_mail(
          'Payment disputed',
          'Unfortunately your payment for %s has had a dispute filed, a dispute on this order has been raised. Please contact your card issuer.' %  order.advert,
          'accounts@foxlisted.com.au',
          [buyer_email], fail_silently=False)
  </code></pre>
  
  <p>Here is the test( i haven't included the user creation and order set up to save space:</p>
  
  <pre><code>   @patch('djstripe.signals.WEBHOOK_SIGNALS[("charge.dispute.created")].send')
      @patch('stripe.Charge.retrieve')
      @patch('notifications.signals.notify.send')
      def test_charge_dispute_created_notifys_users_when_order_completed(self, handler_mock, notify_mock, retrieve_mock):
          obj = {'charge' : 'ch_1234'}
          charge = {'metadata' : {'order' : self.order.pk , 'buyer' : 'test@test.com', 'seller' : 'test2@test.com'} }
          event_data = handler_mock.return_value.json.return_value = obj
          retrieve = retrieve_mock.return_value.json.return_value = charge
  
  
          #test notification getting notify
          # self.assertEqual(len(mail.outbox), 2)
          self.assertTrue(notify_mock.called)
          self.assertEqual(notify_mock.call_count, 1)
  </code></pre>
  
  <p>Essentially i want to mock the handler signal "charge.dispute.created", that way it sends a signal to the handler function, and i can test to see that the emailand notification  has actually been sent. If anyone has a better idea how i should be doing this, or if i am doing this incorrectly please let me know.</p>