'With the setting not enabled and receiving a private message.
The user should not get an email.'

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

    get_current.return_value.domain = 'testserver'
    (s, c) = Setting.objects.get_or_create(user=self.to, name='email_private_messages')
    s.value = False
    s.save()
    assert (not Setting.get_for_user(self.to, 'email_private_messages'))
    self.client.login(username=self.sender.username, password='testpass')
    post(self.client, 'messages.new', {'to': self.to, 'message': 'a    message'})
    assert (not mail.outbox)
