def test_completions(): environ = { 'AWS_DATA_PATH': os.environ['AWS_DATA_PATH'], 'AWS_DEFAULT_REGION': 'us-east-1', 'AWS_ACCESS_KEY_ID': 'access_key', 'AWS_SECRET_ACCESS_KEY': 'secret_key', 'AWS_CONFIG_FILE': '', } with mock.patch('os.environ', environ): completer = Completer() completer.clidriver = create_clidriver() for cmdline, point, expected_results in COMPLETIONS: if point == -1: point = len(cmdline) results = set(completer.complete(cmdline, point)) yield check_completer, cmdline, results, expected_results
def setUp(self): self.last_params = {} # awscli/__init__.py injects AWS_DATA_PATH at import time # so that we can find cli.json. This might be fixed in the # future, but for now we just grab that value out of the real # os.environ so the patched os.environ has this data and # the CLI works. self.environ = { 'AWS_DATA_PATH': os.environ['AWS_DATA_PATH'], 'AWS_DEFAULT_REGION': 'us-east-1', 'AWS_ACCESS_KEY_ID': 'access_key', 'AWS_SECRET_ACCESS_KEY': 'secret_key', } self.environ_patch = mock.patch('os.environ', self.environ) self.environ_patch.start() self.http_response = requests.models.Response() self.http_response.status_code = 200 self.parsed_response = {} self.make_request_patch = mock.patch('botocore.endpoint.Endpoint.make_request') self.make_request_is_patched = False self.operations_called = [] self.parsed_responses = None self.driver = create_clidriver()
def setUp(self): self.last_params = {} # awscli/__init__.py injects AWS_DATA_PATH at import time # so that we can find cli.json. This might be fixed in the # future, but for now we just grab that value out of the real # os.environ so the patched os.environ has this data and # the CLI works. self.environ = { 'AWS_DATA_PATH': os.environ['AWS_DATA_PATH'], 'AWS_DEFAULT_REGION': 'us-east-1', 'AWS_ACCESS_KEY_ID': 'access_key', 'AWS_SECRET_ACCESS_KEY': 'secret_key', } self.environ_patch = mock.patch('os.environ', self.environ) self.environ_patch.start() self.http_response = requests.models.Response() self.http_response.status_code = 200 self.parsed_response = {} self.make_request_patch = mock.patch( 'botocore.endpoint.Endpoint.make_request') self.make_request_is_patched = False self.operations_called = [] self.parsed_responses = None self.driver = create_clidriver()