Commit Graph

59 Commits

Author SHA1 Message Date
Bert Blommers
7acdfe4feb
Introduce Pylint to check for duplicate test method names (#3684) 2021-08-21 16:33:15 +01:00
Anton Grübel
4df099c724
Add cloudwatch tags (#4179)
* Update cloudwatch.put_metric_alarm to accept TreatMissingData and Tags parameter
* Add parameter ExtendedStatistic and EvaluateLowSampleCountPercentile to cloudwatch.put_metric_alarm
* Add parameter ThresholdMetricId to cloudwatch.put_metric_alarm
2021-08-16 08:52:19 +01:00
Macwan Nevil
d2c9e85ed3
Enhanced support for ami filtering (#4175) 2021-08-15 10:09:50 +01:00
Waldemar Hummer
f4f8527955
Merge LocalStack changes into upstream moto (#4082)
* fix OPTIONS requests on non-existing API GW integrations

* add cloudformation models for API Gateway deployments

* bump version

* add backdoor to return CloudWatch metrics

* Updating implementation coverage

* Updating implementation coverage

* add cloudformation models for API Gateway deployments

* Updating implementation coverage

* Updating implementation coverage

* Implemented get-caller-identity returning real data depending on the access key used.

* bump version

* minor fixes

* fix Number data_type for SQS message attribute

* fix handling of encoding errors

* bump version

* make CF stack queryable before starting to initialize its resources

* bump version

* fix integration_method for API GW method integrations

* fix undefined status in CF FakeStack

* Fix apigateway issues with terraform v0.12.21
* resource_methods -> add handle for "DELETE" method
* integrations -> fix issue that "httpMethod" wasn't included in body request (this value was set as the value from refer method resource)

* bump version

* Fix setting http method for API gateway integrations (#6)

* bump version

* remove duplicate methods

* add storage class to S3 Key when completing multipart upload (#7)

* fix SQS performance issues; bump version

* add pagination to SecretsManager list-secrets (#9)

* fix default parameter groups in RDS

* fix adding S3 metadata headers with names containing dots (#13)

* Updating implementation coverage

* Updating implementation coverage

* add cloudformation models for API Gateway deployments

* Updating implementation coverage

* Updating implementation coverage

* Implemented get-caller-identity returning real data depending on the access key used.

* make CF stack queryable before starting to initialize its resources

* bump version

* remove duplicate methods

* fix adding S3 metadata headers with names containing dots (#13)

* Update amis.json to support EKS AMI mocks (#15)

* fix PascalCase for boolean value in ListMultipartUploads response (#17); fix _get_multi_param to parse nested list/dict query params

* determine non-zero container exit code in Batch API

* support filtering by dimensions in CW get_metric_statistics

* fix storing attributes for ELBv2 Route entities; API GW refactorings for TF tests

* add missing fields for API GW resources

* fix error messages for Route53 (TF-compat)

* various fixes for IAM resources (tf-compat)

* minor fixes for API GW models (tf-compat)

* minor fixes for API GW responses (tf-compat)

* add s3 exception for bucket notification filter rule validation

* change the way RESTErrors generate the response body and content-type header

* fix lint errors and disable "black" syntax enforcement

* remove return type hint in RESTError.get_body

* add RESTError XML template for IAM exceptions

* add support for API GW minimumCompressionSize

* fix casing getting PrivateDnsEnabled API GW attribute

* minor fixes for error responses

* fix escaping special chars for IAM role descriptions (tf-compat)

* minor fixes and tagging support for API GW and ELB v2 (tf-compat)

* Merge branch 'master' into localstack

* add "AlarmRule" attribute to enable support for composite CloudWatch metrics

* fix recursive parsing of complex/nested query params

* bump version

* add API to delete S3 website configurations (#18)

* use dict copy to allow parallelism and avoid concurrent modification exceptions in S3

* fix precondition check for etags in S3 (#19)

* minor fix for user filtering in Cognito

* fix API Gateway error response; avoid returning empty response templates (tf-compat)

* support tags and tracingEnabled attribute for API GW stages

* fix boolean value in S3 encryption response (#20)

* fix connection arn structure

* fix api destination arn structure

* black format

* release 2.0.3.37

* fix s3 exception tests

see botocore/parsers.py:1002 where RequestId is removed from parsed

* remove python 2 from build action

* add test failure annotations in build action

* fix events test arn comparisons

* fix s3 encryption response test

* return default value "0" if EC2 availableIpAddressCount is empty

* fix extracting SecurityGroupIds for EC2 VPC endpoints

* support deleting/updating API Gateway DomainNames

* fix(events): Return empty string instead of null when no pattern is specified in EventPattern (tf-compat) (#22)

* fix logic and revert CF changes to get tests running again (#21)

* add support for EC2 customer gateway API (#25)

* add support for EC2 Transit Gateway APIs (#24)

* feat(logs): add `kmsKeyId` into `LogGroup` entity (#23)

* minor change in ELBv2 logic to fix tests

* feat(events): add APIs to describe and delete CloudWatch Events connections (#26)

* add support for EC2 transit gateway route tables (#27)

* pass transit gateway route table ID in Describe API, minor refactoring (#29)

* add support for EC2 Transit Gateway Routes (#28)

* fix region on ACM certificate import (#31)

* add support for EC2 transit gateway attachments (#30)

* add support for EC2 Transit Gateway VPN attachments (#32)

* fix account ID for logs API

* add support for DeleteOrganization API

* feat(events): store raw filter representation for CloudWatch events patterns (tf-compat) (#36)

* feat(events): add support to describe/update/delete CloudWatch API destinations (#35)

* add Cognito UpdateIdentityPool, CW Logs PutResourcePolicy

* feat(events): add support for tags in EventBus API (#38)

* fix parameter validation for Batch compute environments (tf-compat)

* revert merge conflicts in IMPLEMENTATION_COVERAGE.md

* format code using black

* restore original README; re-enable and fix CloudFormation tests

* restore tests and old logic for CF stack parameters from SSM

* parameterize RequestId/RequestID in response messages and revert related test changes

* undo LocalStack-specific adaptations

* minor fix

* Update CodeCov config to reflect removal of Py2

* undo change related to CW metric filtering; add additional test for CW metric statistics with dimensions

* Terraform - Extend whitelist of running tests

Co-authored-by: acsbendi <acsbendi28@gmail.com>
Co-authored-by: Phan Duong <duongpv@outlook.com>
Co-authored-by: Thomas Rausch <thomas@thrau.at>
Co-authored-by: Macwan Nevil <macnev2013@gmail.com>
Co-authored-by: Dominik Schubert <dominik.schubert91@gmail.com>
Co-authored-by: Gonzalo Saad <saad.gonzalo.ale@gmail.com>
Co-authored-by: Mohit Alonja <monty16597@users.noreply.github.com>
Co-authored-by: Miguel Gagliardo <migag9@gmail.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
2021-07-26 15:21:17 +01:00
Bert Blommers
737636f9df
Tech debt (#3653) 2021-02-02 16:31:26 +00:00
Brian Pandola
38124ab1c9
Fix ec2 filter by empty tag value (#3605)
* Fix ec2 filter by empty tag value

Return `None` instead of an empty string when the tag key does not exist
and replace the falsy check with a more explicit `is None`, which allows
empty string values to correctly pass through the filter comparator.

Behavior confirmed against a real AWS backend.

Closes #3603

* Make test case more explicit

Test case now pulled directly from the issue report (#3603).

Co-authored-by: Bert Blommers <bblommers@users.noreply.github.com>
2021-01-24 12:00:25 +00:00
Brian Pandola
cb03223c9b
Add TagSpecification support to ec2:CreateImage (#3604)
* Bump `botocore` to minimum version that supports TagSpecifications for this action.
* Add test coverage.

Closes #3602
2021-01-23 12:57:34 +00:00
Bert Blommers
77dd35e3b8
Use known ImageID in internal tests (#3555) 2021-01-13 09:02:11 +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
Bert Blommers
db1d7123f6 List dependencies for services - add integration test to verify 2020-09-13 16:08:23 +01:00
Larry Aiello
06ed67a8e5
Implement UserIds for Snapshot Attributes (#3192)
* implement register_image

* format code

* add user_ids to snapshot model

* implement register_image

* format code

* add user_ids to snapshot model

* trying to un-deprecate tests

* Write tests and finalize implementation

* Add region parameter to boto3 resource call

* fixed test error
2020-08-01 17:03:54 +01:00
Larry Aiello
2504a398f9
Implement ec2.register_image() (#3177)
* implement register_image

* format code
2020-07-26 13:51:26 +01:00
usmangani1
5988e5efaa
EC2 : Fix - modified volume type in ec2 describe images. (#3074)
* "modified volume type in ec2 describe images"

* removed unncessary comments

* Linting

Co-authored-by: usmankb <usman@krazybee.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
2020-06-15 10:32:43 +01:00
Bert Blommers
df031d0f33 #2732 - Created AMI should have AccountID as the OwnerID 2020-02-08 10:58:31 +00:00
Asher Foa
96e5b1993d Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
Don Kuntz
abf3db8d8a
Add a test to ensure that ec2.copy_image sets the proper owner id
This test is useful because before the last commit using copy_image
would not set the owner_id to the same one used when calling
describe_images.

For example, this code

    conn = boto3.client("ec2")
    copy_resp = conn.copy_image(
        SourceImageId="ami-whatever",
        ...
    )

    describe_resp = conn.describe_images(
        Owners=["self"]
    )

Would result in describe_resp being empty, when it should contain the
image from the copy_resp before it.

By ensuring the owner ids are the same (see ce4059f6) the code example
now works as expected.
2019-07-22 21:57:15 -05:00
Jon Beilke
a744adbcc5 AWS is case-sensitive when using is-public to filter for AMIs and expects lower-case values 2018-12-06 12:18:59 -06:00
Graham Lyons
5d51329c34 Don't create volumes for AMIs (#1456)
* Delete the volume used during AMI creation

Creating an AMI doesn't actually result in the creation of an EBS
volume, although the associated snapshot does reference one. To that
end, delete the volume once we've used it.

* Add `owner_id` to `Snapshot`, verify AMI snapshots

The default AMIs which are created by moto have EBS volume mappings
but the snapshots associated with those don't have the correct
owners set.

This adds the owner to the snapshot model and passes it through from
the JSON data.
2018-03-21 08:55:58 -07:00
William Richard
09c5407b86
Fix tests that were introduced in PR #1398 2018-01-11 15:02:03 -05:00
William Richard
e0d4728c5d
Fix ami tests
- missing and malformed image ids
- test_ami_filters

- test_ami_copy tests

- test_ami_create_and_delete test

- test_ami_filter_wildcard test

- the rest of the tests by using the non-deprecated mock_ec2
2018-01-11 15:02:01 -05:00
William Richard
00a4249b74
Make test_amis not executable, so nose runs it
In trying to debug changes to the ami mock introduced in 1.1.25,
I noticed that the ami tests were not running.  Turns out that nose does not
run test files that are executable.

http://nose.readthedocs.io/en/latest/finding_tests.html

The ami test file was the only test file I could find that had the executable bit set.
2018-01-11 15:00:38 -05:00
Nuwan Goonasekera
56ce26a728 Added support for filtering AMIs by self (#1398)
* Added support for filtering AMIs by self

Closes: https://github.com/spulec/moto/issues/1396

* Adjusted regex to also match signature v4 and fixed py3 compatibility
2018-01-04 10:01:17 +00:00
Nuwan Goonasekera
c68cd650e7 Make sure invalid or malformed AMIs raise an exception
Closes: https://github.com/spulec/moto/issues/1408
2017-12-22 18:50:22 +05:30
Terry Cain
bd8c1e4567
adding owner id to amis v2 (#1331)
* Adding owner-id/OwnerId to the AMI classes to allow the value to be specified to test filtering images based on owner.

* Added default AMIs and filtering by owner-id

* Fixed some tests

* Fixed more random tests

* Updated MANIFEST

* .
2017-11-12 11:18:25 +00:00
Nuwan Goonasekera
c116c57eb8 Ensure root device is listed in block device mappings 2017-09-15 21:30:32 +05:30
Steve Pulec
0adebeed24 Merge #913. 2017-05-10 21:58:42 -04:00
Steve Pulec
408a70992c Fix filter wildcards. Closes #910. 2017-05-10 21:33:34 -04:00
Steve Pulec
f37bad0e00 Lints. 2017-02-23 21:37:43 -05:00
Steve Pulec
81836b6981 Get standalone server mode working for all tests. 2017-02-23 19:43:48 -05:00
Steve Pulec
fde721bed7 Testing new version of decorator. 2017-02-15 22:35:45 -05:00
rocky4570fft
d6f76cbb43 Add dry_run to a number of EC2 services 2016-10-16 00:34:52 +10:00
Mervyn Russell
43ff874b68 Amended test_ami_create_and_delete to include test for existence of creation date 2016-08-26 15:14:04 +01:00
Steve Pulec
44f0377cc4 Fix root volume to show up in other EC2 volume API calls. Closes 470 2015-11-28 09:19:45 -05:00
dreadpirateshawn
d631f869c1 ModifyImageAttribute: Added support for user permissions. 2015-01-23 09:43:54 -08:00
Steve Pulec
8954242086 Better is_public support for AMIs including filtering. Closes #263. 2014-11-19 20:09:46 -05:00
Steve Pulec
b39861052b Make AMI test more explicit with region. 2014-11-15 10:06:14 -05:00
Hugo Lopes Tavares
aee47395f7 Implement "name" filter to ec2.models.AMI 2014-10-10 15:14:46 -04:00
Steve Pulec
f0724d458e Merge pull request #216 from DreadPirateShawn/ImplementCopyImage
AMI: Implement copy_image.
2014-10-05 10:55:48 -04:00
Joseph Lawson
7fca88e732 Test Fixes and tag: filter.
* fixed test_ec2.test_amis.test_ami_filters to test for AMIs in the state of 'available'
  * enhanced AMI's to be able to take `tag:` filter.
  * added tag: tests for AMIs
2014-09-30 16:42:52 -04:00
Joseph Lawson
866d8b4ea8 allow get_filter_value to return state of ami and test
* updated Ami.get_filter_value to return the state value of the AMI
  * updated test_ec2.test_amis.test_ami_filters to test for AMIs in the state of 'available'
2014-09-30 16:12:23 -04:00
dreadpirateshawn
635a0e0f64 AMI: Implement copy_image. (part 3, added boto version threshold) 2014-09-29 12:28:53 -07:00
dreadpirateshawn
a4fdce2e55 AMI: Implement copy_image. 2014-09-29 12:06:36 -07:00
Steve Pulec
cfda83dcba Merge pull request #180 from DreadPirateShawn/AMIsModifyAndDescribe
AMIs: Added ModifyImageAttribute and DescribeImages filtering.
2014-08-27 21:28:15 -04:00
Shawn Falkner-Horine
f9246def75 AMIs: Added ModifyImageAttribute and DescribeImages filtering. 2014-08-27 11:53:44 -07:00
David Baumgold
4201e6b430 from __future__ import unicode_literals 2014-08-27 11:33:55 -04:00
Shawn Falkner-Horine
c97417d8e7 Error handling: Model-level validations, proper error responses. (backport assert_raises as context manager for Python 2.6) 2014-08-25 15:09:38 -07:00
Shawn Falkner-Horine
071c03e216 Error handling: Model-level validations, proper error responses. 2014-08-25 10:54:47 -07:00
Steve Pulec
955b4c6c4a Add tagging to all applicable EC2 objects. Closes #66. 2014-05-11 19:00:28 -04:00