@patch('bedrock.mozorg.views.requests.post')
def test_sf_form_proxy_error_response(self, post_patch):
    'An error response from SF should be returned.'
    new_mock = Mock()
    new_mock.status_code = 400
    post_patch.return_value = new_mock
    with self.activate('en-US'):
        url = reverse('mozorg.partnerships')
        resp = self.client.post(url, {'first_name': 'The', 'last_name': 'Dude', 'company': 'Urban Achievers', 'email': 'example@example.com'}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    self.assertEqual(resp.status_code, 400)
    resp_data = simplejson.loads(resp.content)
    self.assertEqual(resp_data['msg'], 'bad_request')
    self.assertTrue(post_patch.called)
An error response from SF should be returned.
@patch('bedrock.mozorg.views.requests.post')
def test_sf_form_proxy_error_response(self, post_patch):
    
    new_mock = Mock()
    new_mock.status_code = 400
    post_patch.return_value = new_mock
    with self.activate('en-US'):
        url = reverse('mozorg.partnerships')
        resp = self.client.post(url, {'first_name': 'The', 'last_name': 'Dude', 'company': 'Urban Achievers', 'email': 'example@example.com'}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    self.assertEqual(resp.status_code, 400)
    resp_data = simplejson.loads(resp.content)
    self.assertEqual(resp_data['msg'], 'bad_request')
    self.assertTrue(post_patch.called)