'Tests handling of HTTPError'

def test_send_http_request_http_error(self):

    na_element = zapi_fakes.FAKE_NA_ELEMENT
    self.mock_object(self.root, '_create_request', return_value=('abc', zapi_fakes.FAKE_NA_ELEMENT))
    self.mock_object(netapp_api, 'LOG')
    self.root._opener = zapi_fakes.FAKE_HTTP_OPENER
    self.mock_object(self.root, '_build_opener')
    self.mock_object(self.root._opener, 'open', side_effect=urllib.error.HTTPError(url='', hdrs='', fp=None, code='401', msg='httperror'))
    self.assertRaises(netapp_api.NaApiError, self.root.send_http_request, na_element)
