class TestSendToFriend(HttpTestCase): fixtures=['giftstore/fixtures/products.json'] def test_submit_message(self): self.user = User.objects.create_user(username='senduser', \ email='senduser@gift.com', password='senduser') self.user.first_name = 'senduser' self.user.save() self.login(username='senduser', password='senduser', formid=4) product = Product.objects.get(slug='hollywood-dominoes') self.go200(reverse('send-to-friend') + '?product=%s' % product.id) self.fv(4, 'message', 'It is the excellent product!') self.fv(4, 'friend_name', 'test friend') self.fv(4, 'friend_email', 'testfriend@gift.com') self.submit200() self.find('Your message has been sent.') assert len(mail.outbox) == 1