def __init__(self, inception_host: Optional[str] = None, authentication: Optional[authentication_type] = None): inception_host = inception_host or os.getenv('INCEPTION_HOST') authentication = authentication or (os.getenv('INCEPTION_USERNAME'), os.getenv('INCEPTION_PASSWORD')) if not inception_host: raise ConfigurationNotProvided( "Host was not provided. You can set it via environment variable as 'INCEPTION_HOST'" ) if not all(authentication): raise ConfigurationNotProvided( "Authentication was not provided. " "You can set it via environment variables as 'INCEPTION_USERNAME' and 'INCEPTION_PASSWORD'" ) self.api = HttpInceptionAdapter(inception_host, authentication)
def mock_http_adapter(mock_http_client): adapter = HttpInceptionAdapter('test-host', (None, None)) adapter.client = mock_http_client return adapter