'rest_dispatch rejects requests from deactivated users, both /json and api'

def test_send_deactivated_user(self):

    user_profile = self.example_user('hamlet')
    email = user_profile.email
    self.login(email)
    do_deactivate_user(user_profile)
    result = self.client_post('/json/messages', {'type': 'private', 'content': 'Test    message', 'client': 'test    suite', 'to': self.example_email('othello')})
    self.assert_json_error_contains(result, 'Not    logged    in', status_code=401)
    do_reactivate_user(user_profile)
    self.login(email)
    user_profile.is_active = False
    user_profile.save()
    result = self.client_post('/json/messages', {'type': 'private', 'content': 'Test    message', 'client': 'test    suite', 'to': self.example_email('othello')})
    self.assert_json_error_contains(result, 'Account    not    active', status_code=400)
    result = self.client_post('/api/v1/messages', {'type': 'private', 'content': 'Test    message', 'client': 'test    suite', 'to': self.example_email('othello')}, **self.api_auth(self.example_email('hamlet')))
    self.assert_json_error_contains(result, 'Account    not    active', status_code=401)
