Commit Graph

109 Commits

Author SHA1 Message Date
Brian Pandola
f4b81e69b8
Address pytest warnings (#3629)
* Address `boto` deprecation warnings

This commit eliminates the following warning:

../boto/ec2/connection.py:582:
  PendingDeprecationWarning: The current get_all_instances implementation will be replaced with get_all_reservations.

`boto` isn't likely to ever make good on this warning, but doing the replacement will
declutter the `moto` test output.

* Remove `invoke_lambda` tracebacks from unit test logging

If an exception is encountered, the details are returned in the response payload.
Printing the traceback was just adding noise to the pytest output.

* Use known AMIs in unit tests

This commit eliminates the following warning in the pytest output:

`PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.`

Known, pre-loaded AMI image ids are used instead of random ids that don't actually
exist in the moto backend.  The integrity of the tests is unaffected by this change.

A test has been added to provide explicit coverage of the PendingDeprecationWarning
raised when an invalid AMI image id is passed to moto.
2021-01-29 11:31:56 +00:00
Brian Pandola
cd25ab7a16
Fix: broken build with release of botocore 1.19.62 (#3628)
The latest release of `botocore` (1.19.62) makes changes to the parameter
validation code, which for some reason was also covered by a couple of
`moto` tests.

These tests, when run, do not execute any `moto` code.  They fail the
parameter validation check in `botocore`, which raises an exception
before ever sending a request.  These tests do not cover or verify
any `moto` behavior and have been removed.

Ref: ff8ae76ecc

Closes #3627
2021-01-29 09:06:25 +00:00
Bert Blommers
8591eda9d6
Introduce Github Actions to replace TravisCI (#3610) 2021-01-26 12:37:03 +00:00
Bert Blommers
273ca63d59 Linting 2020-11-11 15:55:37 +00:00
Matěj Cepl
5697ff87a8 Back to Black 2020-11-10 14:12:38 +01:00
Matěj Cepl
ea489bce6c Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
Matěj Cepl
77dc60ea97 Port test suite from nose to pytest.
This just eliminates all errors on the tests collection. Elimination of
failures is left to the next commit.
2020-11-10 08:23:44 +01:00
Brian Pandola
3b9635b3c7 Add ssm:SendCommand support for instance tag Targets
Replace the special-case code to handle Cloud Formation tags with a more
generic implementation that covers all instance tags.

Supersedes #2863
Closes #2862
2020-11-08 00:06:35 -08:00
Bert Blommers
db1d7123f6 List dependencies for services - add integration test to verify 2020-09-13 16:08:23 +01:00
Ninh Khong
ff1f565142
Enhance function get_parameter by parameter name, version or labels (#3191)
Co-authored-by: Ninh Khong <ninh@1on1english.vn>
2020-07-28 16:59:22 +01:00
Jordan Reiter
28d1d762af
Enforce parameter naming (#3190)
* Enforce parameter naming

Parameters are not allowed to start with `ssm` or `aws`. This commit adds error messages which
correspond exactly to the error messages returned by boto3.

* Fix for Python 2 compatibility

f-strings not supported in Python 2.7
2020-07-28 15:26:59 +01:00
Jordan Reiter
126f5a5155
Implement Filter: Contains functionality for describe_params (#3189)
* Implement Filter: Contains functionality for describe_params

This commit adds the Contains functionality. Tests were created
to mimic behavior in AWS/boto3, including that filters with values
in the form of `/name` will match parameters named `/name/match` but
not parameters named `match/with/other-name`. In the test example, a
Contains filter with the value `/tan` would match: `/tangent-3` and
`tangram-4` but not `standby-5`.

* Enforce parameter filter restrictions on get_parameters_by_path

According to the boto3 documentation [1], `Name`, `Path`, and `Tier` are not
allowed values for `Key` in a parameter filter for `get_parameters_by_path`.

This commit enforces this by calling `_validate_parameter_filters` from the
`get_parameters_by_path` method, and adding a check to `_validate_parameter_filters`.

I added 3 test cases to `test_get_parameters_by_path` which check for the correct
exception when calling with a parameter filter using any of these keys.

* Code formatted to match style

* Refactored logic
2020-07-28 10:17:35 +01:00
Alex Bainbridge
c1326ed8cc removed done comments 2020-07-03 13:25:03 -04:00
Alex Bainbridge
487829810f passes python3 and 2.7. added additional few tests for coverage bump 2020-07-02 13:43:14 -04:00
Alex Bainbridge
c9b38e25b8 black linting 2020-06-30 12:43:42 -04:00
Alex Bainbridge
82825787db all tests passing 2020-06-30 12:39:52 -04:00
Alex Bainbridge
bdc1e93a4f most of testing is done 2020-06-29 18:20:57 -04:00
Alex Bainbridge
e2f6544228 ssm document code done, testing now 2020-06-26 10:47:28 -04:00
Anton Grübel
65e790c4eb
Add dynamodb continuous backups (#2976)
* remove print statement

* Add dynamodb.describe_continuous_backups

* Add dynamodb.update_continuous_backups

* Fix Python 2 timestamp error
2020-05-08 15:57:48 +01:00
gruebel
3b8c8fafe2 Fix ssm.get_parameters missing validation 2020-05-06 14:38:25 +02:00
Brent Driskill
e3e4b741d8 SSM: Fix the formatting associated with label_parameter_version/get_parameter_history updates 2020-03-11 11:57:04 -04:00
Brent Driskill
5705695495 SSM: Added support for label_parameter_version and getting labels on get_parameter_history 2020-03-11 10:43:18 -04:00
Olabode Anise
9227845121 using assert_raises 2020-02-27 07:29:13 -05:00
Olabode Anise
607e0a8452 ENH: changes the behavior of delete_parameter to respond with a 400 error when the parameter does not exist.
Currently, the delete_parameter function for the ssm client will respond with a dict containing a key of Invalid Parameter which has a value of a list containing the parameter name that was requested to be deleted when a parameter with said name doesn't exist which doesn't match the behavior of boto3.
2020-02-26 07:13:32 -05:00
Mike Grima
65b17e740d
Merge pull request #2611 from Sytten/fix/ssm-parameter
Add missing information in SSM parameters
2019-12-16 11:59:42 -08:00
Emile Fugulin
b52fa636b6 Add missing information in SSM parameters 2019-11-30 20:05:01 -05:00
Adam Smith
051193e1bf Add Pagination to ssm:get_parameters_by_path. Closes #1864 2019-11-27 22:12:31 +00:00
William Richard
715ff0f7af
Return a sensible error when the parameter is not found 2019-11-04 15:31:15 -05:00
William Richard
3816eba58f
Fix linting 2019-11-04 13:04:10 -05:00
William Richard
aeb7974549
Add get_parameter_history implementation and tests 2019-11-04 12:49:09 -05:00
Asher Foa
96e5b1993d Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
gruebel
2cfd3398f6 Add ParameterFilters to SSM describe_parameters 2019-10-05 14:05:47 +02:00
Steve Pulec
e8551988d9
Merge pull request #2000 from AlanAlexander-Janrain/master
Updating the list of urls the SSM moto will match to include china
2018-12-28 21:27:45 -05:00
Alan Alexander
36b0117eec Updating the list of urls the SSM moto will match to include china 2018-12-19 15:02:36 -08:00
Craig Anderson
96ed66c08d
Add AllowedPattern to SSM describe_parameters response (#1955) 2018-11-27 15:31:56 +00:00
Mike Liu
1b1fc4c030 Support getting cloudformation targets for the SSM backend.
SendCommand allows filtering for instances by tags. This adds support
for filtering by a cloud formation stack resource when creating command
invocations.
2018-08-09 10:34:59 -04:00
Mike Liu
12807bb6f0 Add get_command_invocation endpoint for AWS SSM.
Users can make send_command requests and then retrieve the invocations
of those commands with get_command_invocation. Getting a command
invocation by instance and command id is supported but only the
'aws:runShellScript' plugin name is supported and only one plugin in a
document is supported.
2018-07-25 14:51:16 -04:00
Steve Pulec
f3175118d1
Merge pull request #1600 from nimbis/extend-ssm-backend
Extend ssm backend
2018-07-19 08:44:30 -04:00
Nate Peterson
dcdaca8984 parameters return from root path (#1701) 2018-07-13 10:24:11 +01:00
Alex Casalboni
cb364eedc6 Implement SSM Parameter Store filters support (GetParametersByPath API) (#1604)
* added tests for SSM Parameter Store filters (GetParametersByPath - ParameterStringFilter)

* implemented SSM Parameter Store filters support (only for get_parameters_by_path API)

* adding myself to authors file
2018-04-30 11:02:46 -07:00
Mike Liu
a0882316ec Tests for ListCommands SSM API endpoint.
Test that ListCommands returns commands sent by SendCommand as well as
filters by CommandId and InstanceId. In addition update the SendCommand
test for optional parameters.
2018-04-25 16:27:07 -04:00
Tom Elliff
21a264c337 Default TimeoutSeconds to 1 hour (#1592)
TimeoutSeconds isn't a required field so we can't rely on it being there.
Quick tests against the AWS API show that when it's not specified the ExpiresAfter field seems to be 1 hour after the request.
2018-04-23 11:41:54 -07:00
ramox-
508b392697 Make putparameter behave more like the real endpoint does, respond with Version or ParameterAlreadyExists (#1464) 2018-03-21 08:56:57 -07:00
Chris Wolfe
7a6987a7f1 note 2018-02-19 09:59:52 -06:00
Chris Wolfe
8ac4ff1e99 greater granularity 2018-02-19 09:58:46 -06:00
Chris Wolfe
29061ec0f8 add a basic test to start 2018-02-19 09:10:52 -06:00
Victor Hiairrassary
caec929506 Improve SSM PutParameter & DescribeParameters actions (#1348) 2017-11-17 08:57:11 +00:00
Kai Xia(夏恺)
3740db8059 Added support for SSM get_parameters_by_path. (#1299)
* Added support for SSM get_parameters_by_path.

Signed-off-by: Kai Xia <xiaket@gmail.com>

* add logic to handle trailing '/'.

Also, fix pep8.

Signed-off-by: Kai Xia <kai.xia@sportsbet.com.au>

* add tests for parameter value in response.

Signed-off-by: Kai Xia <kai.xia@sportsbet.com.au>
2017-11-06 09:44:54 +00:00
Terry Cain
81026dd1d7
Newlines for more pep8 compliance 2017-09-18 21:46:07 +01:00
Terry Cain
783c287e51
Added non existant parameter test + needed error responses 2017-09-18 21:27:56 +01:00
Terry Cain
cf7e07b728 Added GetParameter support 2017-09-18 14:13:02 +01:00
Ali Rizwan
1c96335895 get_parameters should list InvalidParameters
Signed-off-by: Ali Rizwan <ari@hellofresh.com>
2017-08-16 12:49:03 +02:00
Ali Rizwan
d8b0df2bef Added support for SSM delete_parameters
Signed-off-by: Ali Rizwan <ari@hellofresh.com>
2017-08-11 15:19:36 +02:00
James Brennan
a5089c3d69 Add add, remove, list endpoints for SSM tags 2017-07-26 11:38:12 +00:00
Declan Shanaghy
7bf5211bef Simplify test 2 2017-06-26 12:07:44 -07:00
Declan Shanaghy
27f1248788 Fix spacing 2017-06-26 11:20:56 -07:00
Declan Shanaghy
8ca27e184a Simplify tests 2017-06-26 11:17:36 -07:00
Declan Shanaghy
db20dfcd82 Added filtering 2017-06-20 11:47:53 -07:00
Michael van Tellingen
783a1d73b4 Implement support for SSM parameter store
This commit adds initial support for the Simple System Manager client.

It currently only mocks the following api endpoints:
 - delete_parameter()
 - put_parameter()
 - get_parameters()
2017-04-18 19:09:10 +02:00