'Creating a new thread should email responses'

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

    get_current.return_value.domain = 'testserver'
    d = DocumentFactory()
    u = UserFactory()
    self.client.login(username=u.username, password='testpass')
    s = Setting.objects.create(user=u, name='kbforums_watch_new_thread', value='False')
    data = {'title': 'a    title', 'content': 'a    post'}
    post(self.client, 'wiki.discuss.new_thread', data, args=[d.slug])
    t1 = ThreadFactory(document=d)
    assert (not NewPostEvent.is_notifying(u, t1)), 'NewPostEvent    should    not    be    notifying.'
    s.value = 'True'
    s.save()
    post(self.client, 'wiki.discuss.new_thread', data, args=[d.slug])
    t2 = Thread.objects.all().order_by('-id')[0]
    assert NewPostEvent.is_notifying(u, t2), 'NewPostEvent    should    be    notifying'
