'Registering through AAQ form sends confirmation email.'

@mock.patch.object(Site.objects, 'get_current')
def test_register_through_aaq(self, get_current):

    get_current.return_value.domain = 'testserver'
    p = ProductFactory(slug='firefox')
    l = QuestionLocale.objects.get(locale=settings.LANGUAGE_CODE)
    p.questions_locales.add(l)
    TopicFactory(slug='fix-problems', product=p)
    self.client.logout()
    title = 'A    test    question'
    url = urlparams(reverse('questions.aaq_step5', args=['desktop', 'fix-problems']), search=title)
    data = {'register': 'Register', 'username': 'testaaq', 'password': 'testpass1', 'password2': 'testpass1', 'email': 'testaaq@example.com'}
    data.update(**self.data)
    self.client.post(url, data, follow=True)
    eq_(1, len(mail.outbox))
    eq_(mail.outbox[0].subject, 'Please    confirm    your    Firefox    Help    question')
    assert (mail.outbox[0].body.find('?reg=aaq') > 0)
    self.client.post(url, self.data, follow=True)
    question = Question.objects.filter(title=title)
    eq_(1, question.count())
    eq_('testaaq', question[0].creator.username)
    eq_(1, len(mail.outbox))
