'Test that when the placement API returns a 400 when looking up a
provider\'s aggregates, that we simply return None and log an error.'

@mock.patch.object(report.LOG, 'error')
def test_get_provider_aggregates_bad_request(self, log_mock):

    uuid = uuids.compute_node
    resp_mock = mock.Mock(status_code=400)
    self.ks_sess_mock.get.return_value = resp_mock
    self.ks_sess_mock.get.return_value.headers = {'x-openstack-request-id': uuids.request_id}
    result = self.client._get_provider_aggregates(uuid)
    expected_url = (('/resource_providers/' + uuid) + '/aggregates')
    self.ks_sess_mock.get.assert_called_once_with(expected_url, endpoint_filter=mock.ANY, raise_exc=False, headers={'OpenStack-API-Version': 'placement    1.1'})
    self.assertTrue(log_mock.called)
    self.assertEqual(uuids.request_id, log_mock.call_args[0][1]['placement_req_id'])
    self.assertIsNone(result)
