MCPcopy Create free account
hub / github.com/aws/aws-cli / assert_params_for_cmd

Method assert_params_for_cmd

awscli/testutils.py:488–515  ·  view source on GitHub ↗
(
        self,
        cmd,
        params=None,
        expected_rc=0,
        stderr_contains=None,
        ignore_params=None,
    )

Source from the content-addressed store, hash-verified

486 return http_response, parsed_response
487
488 def assert_params_for_cmd(
489 self,
490 cmd,
491 params=None,
492 expected_rc=0,
493 stderr_contains=None,
494 ignore_params=None,
495 ):
496 stdout, stderr, rc = self.run_cmd(cmd, expected_rc)
497 if stderr_contains is not None:
498 self.assertIn(stderr_contains, stderr)
499 if params is not None:
500 # The last kwargs of Operation.call() in botocore.
501 last_kwargs = copy.copy(self.last_kwargs)
502 if ignore_params is not None:
503 for key in ignore_params:
504 try:
505 del last_kwargs[key]
506 except KeyError:
507 pass
508 if params != last_kwargs:
509 self.fail(
510 "Actual params did not match expected params.\n"
511 "Expected:\n\n"
512 "%s\n"
513 "Actual:\n\n%s\n" % (pformat(params), pformat(last_kwargs))
514 )
515 return stdout, stderr, rc
516
517 def before_parameter_build(self, params, model, **kwargs):
518 self.last_kwargs = params

Calls 2

run_cmdMethod · 0.95
copyMethod · 0.45

Tested by

no test coverage detected