'Tests the autowatch setting of users.
If a user has the setting turned on, they should get
notifications after posting in a thread for that thread. If they
have that setting turned off, they should not.'

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

    get_current.return_value.domain = 'testserver'
    u = UserFactory()
    t1 = QuestionFactory()
    t2 = QuestionFactory()
    assert (not QuestionReplyEvent.is_notifying(u, t1))
    assert (not QuestionReplyEvent.is_notifying(u, t2))
    self.client.login(username=u.username, password='testpass')
    s = Setting.objects.create(user=u, name='questions_watch_after_reply', value='True')
    data = {'content': 'some    content'}
    post(self.client, 'questions.reply', data, args=[t1.id])
    assert QuestionReplyEvent.is_notifying(u, t1)
    s.value = 'False'
    s.save()
    post(self.client, 'questions.reply', data, args=[t2.id])
    assert (not QuestionReplyEvent.is_notifying(u, t2))
