Example #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
Example #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
Example #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
Example #4
0
 def wrapped_request(*args, **kwargs):
     wrapped_request.called = True
     return original_request(*args, **kwargs)
Example #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)
Example #6
0
 def wrapped_request(*args: Any, **kwargs: Any) -> requests.Response:
     called[0] = True
     return original_request(*args, **kwargs)
Example #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)
Example #8
0
 def wrapped_request(*args, **kwargs):
     wrapped_request.called = True
     return original_request(*args, **kwargs)