'authenticated_json_view views fail with a deactivated user'

def test_fetch_api_key_deactivated_user(self):

    user_profile = self.example_user('hamlet')
    email = user_profile.email
    test_password = 'abcd1234'
    user_profile.set_password(test_password)
    user_profile.save()
    self.login(email, password=test_password)
    user_profile.is_active = False
    user_profile.save()
    result = self.client_post('/json/fetch_api_key', {'password': test_password})
    self.assert_json_error_contains(result, 'Account    not    active', status_code=400)
