def test_messaging_as_attendee(self):
self.presentation.proposal.registrants.add(self.user)
self.login()
rsp = self.client.get(self.tutorial_url)
self.assertIn('id="messages"', rsp.content)
# We can display the page prompting for a message to send them
url = reverse(
'tutorial_message', kwargs={'pk': self.presentation.proposal.pk})
rsp = self.client.get(url)
self.assertEqual(200, rsp.status_code)
# "Send" a message to those two applications
test_message = 'One if by land and two if by sea'
data = {'message': test_message, }
rsp = self.client.post(url, data=data)
self.assertEqual(302, rsp.status_code)
msg = PyConTutorialMessage.objects.get(
user=self.user,
tutorial=self.presentation.proposal)
self.assertEqual(test_message, msg.message)
# For each message, it's visible, so it should have been emailed to
# both the other attendees and speakers. Total: 1 message for this case
self.assertEqual(1, len(mail.outbox))
评论列表
文章目录