def post(self, request): if 'title' not in request.POST: return HttpResponse("expecting a title") statsd.incr('main.received') title = request.POST.get('title', 'no title') ruuid = uuidparse(title) r = Operation.objects.filter(uuid=ruuid) if r.count() == 1: operation = r[0] if operation.video.is_mediathread_submit(): send_mediathread_received_mail(operation.video.title, operation.owner.username) else: statsd.incr('main.received_failure') return HttpResponse("ok")
def test_send_mediathread_received_mail(self): send_mediathread_received_mail("fake video", "fakeuni") assert len(mail.outbox) > 1 self.assertEqual(mail.outbox[0].subject, "Mediathread submission received")