Exemplo n.º 1
0
 def mock_request(method, url, **kwargs):
     if 'standby' in url:
         mock_request.standby_count += 1
         return _standby_response()
     elif 'localhost' in url:
         mock_request.active_count += 1
         return original_request(method, url, **kwargs)
     else:
         self.fail("Unexpected url {}".format(url))  # pragma: no cover
Exemplo n.º 2
0
 def mock_request(method, url, **kwargs):
     if 'standby' in url:
         mock_request.standby_count += 1
         return _standby_response()
     elif 'localhost' in url:
         mock_request.active_count += 1
         return original_request(method, url, **kwargs)
     else:
         self.fail("Unexpected url {}".format(url))  # pragma: no cover
Exemplo n.º 3
0
 def mock_request(method: str, url: str,
                  **kwargs: object) -> requests.Response:
     if "standby" in url:
         standby_count[0] += 1
         return _standby_response()
     elif "localhost" in url:
         active_count[0] += 1
         return original_request(method, url, **kwargs)
     else:
         self.fail("Unexpected url {}".format(url))  # pragma: no cover
Exemplo n.º 4
0
 def wrapped_request(*args, **kwargs):
     wrapped_request.called = True
     return original_request(*args, **kwargs)
Exemplo n.º 5
0
def _hacked_request(method, url, **kwargs):
    """Hack to "redirect" hostnames that the VM knows to localhost"""
    url = url.replace('quickstart.cloudera', 'localhost')
    return original_request(method, url, **kwargs)
Exemplo n.º 6
0
 def wrapped_request(*args: Any, **kwargs: Any) -> requests.Response:
     called[0] = True
     return original_request(*args, **kwargs)
Exemplo n.º 7
0
def _hacked_request(method, url, **kwargs):
    """Hack to "redirect" hostnames that the VM knows to localhost"""
    url = url.replace('quickstart.cloudera', 'localhost')
    return original_request(method, url, **kwargs)
Exemplo n.º 8
0
 def wrapped_request(*args, **kwargs):
     wrapped_request.called = True
     return original_request(*args, **kwargs)