Commit Graph

134 Commits

Author SHA1 Message Date
Guilherme Martins Crocetti
0dd41d4c32
Cloudformation support for EventSourceMapping (#3045)
* change line position for uuid and last_modified because they're not input parameters

* add event_source_arn validator and setter

* refactor batch_size as setter

* add helper function to parse arn and return source service

* fix for EventSource's create_from_cfn, there was no reference in the lambda object for the esm if created by cfn

* add esm deletion by cloudformation

* remove unused variable in test

* add cfn's update

* add complete implementation of delete_from_cfn

* blacked changed files

* fix test with invalid batchsize for sqs

* Dynamodb2 Table - Bugfix for localindex and implemented get_cfn_attributes

* Dynamodb2 eventsource - fix test to use StreamArn attribute

* Lambda Test - fix test_update_event_source_mapping
2020-06-14 16:03:00 +01:00
Bert Blommers
0718525a2a Linting 2020-05-07 12:29:18 +01:00
Bert Blommers
f82e834225 Lambda - Only return Logs if LogType=Tail 2020-05-07 10:55:15 +01:00
Bert Blommers
be5b1c592f Lambda - Add actual logs to LogResult, instead of replicating the response 2020-05-07 10:40:24 +01:00
Bert Blommers
9ab02e17d5 #883 - Lambda - Add test to verify remove_permission functinonality 2020-04-03 10:30:05 +01:00
Bert Blommers
038ff620b2 DDB Streams - Bugfix where processed items are resend every time 2020-02-24 09:28:52 +00:00
Bert Blommers
736f8b5a8f Refactor - reuse logic that expects CW log message 2020-02-24 08:24:14 +00:00
Steve Pulec
d297fc08f2
Merge pull request #2755 from bblommers/dynamodbstreams_update_item
DynamoDB - Send item to DDB Stream on update, not just on create
2020-02-18 18:15:25 -06:00
Bert Blommers
5863d9fab9 Linting 2020-02-18 12:34:24 +00:00
Bert Blommers
9971bcdfcd DynamoDB - Send item to DDB Stream on update, not just on create 2020-02-18 11:49:55 +00:00
Steve Pulec
aeb194fc57 Update new lambda test to work with updated status codes. CC #2642. 2020-02-17 17:29:00 -06:00
Steve Pulec
039656f84d
Merge pull request #2704 from bblommers/bugfix/2642
Fix AWS Lambda status code on invoke
2020-02-15 10:46:01 -06:00
Steve Pulec
e40d75359a
Merge pull request #2717 from bblommers/feature/s3_illegallocationconstraint
S3 Feature: Add IllegalLocationConstraintException
2020-02-15 10:41:00 -06:00
Terry Griffin
b4c9b76ca9 Added 'x-amzn-ErrorType' in return header from lambda:get_function for missing function 2020-02-06 15:26:20 -08:00
Mike Grima
bb64258a8f Fixed issue with Lambda invoke via ARN
- Fixed an issue where Lambda invokes via an ARN was hitting real AWS.
2020-02-04 22:12:11 -08:00
Bert Blommers
e21ddb7abc
Use var instead of hardcoded string for region 2020-02-02 14:25:44 +00:00
Bert Blommers
a86cba79de Add S3 LocationConstraint to Lambda tests 2020-02-02 11:48:32 +00:00
Bert Blommers
da40c7125a
Merge pull request #2703 from brady-gsa/fix_lambda_config
Fixes awslambda policy management
2020-01-29 15:30:25 +00:00
Brady
2a2ff32dec improves support for AWS lambda policy management 2020-01-24 14:53:16 -05:00
Andrey Kislyuk
324ef5af36 Fix test 2020-01-24 16:11:44 +00:00
Bert Blommers
ccd0257acc Fix Lambda tests for DryRuns 2020-01-24 10:09:56 +00:00
Bert Blommers
ee8231202a Fix linting 2020-01-24 09:08:48 +00:00
Roque Pinel
2ae09c5335 Fix the StatusCode returned by lambda invoke
According to the AWS documentation:
```
The HTTP status code will be in the 200 range for successful request.
For the RequestResponse invocation type this status code will be 200.
For the Event invocation type this status code will be 202.
For the DryRun invocation type the status code will be 204.
```
2020-01-24 09:07:49 +00:00
Bert Blommers
5884483019 Compare map, instead of string repr 2020-01-09 10:08:35 +00:00
Bert Blommers
cba3cfc384 Escape curly braces in formatting string 2020-01-09 09:10:16 +00:00
Bert Blommers
eab9e15bf0 #2623 - Fix and simplify test in ServerMode 2020-01-05 15:01:31 +00:00
Fabio Dias
743dd46399 black linting 2019-12-16 21:25:20 -05:00
Fabio Dias
b83a750630 Added references to moto.iam.models.ACCOUNT_ID instead of hardcoded id 2019-12-16 19:56:11 -05:00
Bert Blommers
d759f16331 Specify region name when creating Lambda roles 2019-11-22 08:12:47 +00:00
Bert Blommers
5f6e8fd6fe Merge branch 'master' into feature/2546 2019-11-22 06:22:54 +00:00
Bert Blommers
1d85288244 Ensure Flask sends through custom error messages 2019-11-20 08:57:38 +00:00
Bert Blommers
0ea98f22ee Merge branch 'master' into feature/2546 2019-11-19 08:00:59 +00:00
Mike Grima
bd777cad44 Fix for moto not unmocking.
- Fixes #2575
- Also upgraded Travis CI to make use of Bionic instead of Xenial
- This may also address concerns raised in #1793
2019-11-18 15:28:31 -08:00
Mike Grima
27f36a7514 Fixed the Lambda invocation due to lambci changes.
It looks like lambci is pre-pending the "lambda" responses with an
escape character `\033`. This was breaking the unit tests.
2019-11-17 18:40:15 -08:00
Bert Blommers
40aa73a12b #2546 - AWS Lambda: Add Role validation when creating functions 2019-11-07 17:11:13 +00:00
Ian Yon
9e2b47e82b Applied black formatter 2019-11-04 12:22:03 -03:00
Ian Yon
577419798d Merge from master to current branch 2019-11-04 12:14:43 -03:00
Ian Yon
90a9235f4c Allow lambda get function by arn and addded environment configuration 2019-11-04 10:44:01 -03:00
Asher Foa
96e5b1993d Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
Jack Danger
b6fe526add
Merge pull request #2502 from bblommers/feature/lambda-delete-by-arn
Feature - Lambda Delete by arn
2019-10-22 16:02:33 -07:00
Jack Danger
a05c7da3bb
Implement support for lambda policies (#2471)
* Implement support for lambda policies

* Fixing two tests that weren't running

* Getting tests running under Python 2.7
2019-10-22 14:09:44 -07:00
Bert Blommers
ce4bd5d64c AWS Lambda - Allow function deletions by ARN 2019-10-22 09:31:37 +01:00
Christian Clauss
c3c75c12d9
Use ==/!= to compare str, bytes, and int literals
Python 3.8 will probably [raise SyntaxWarnings](https://docs.python.org/3/whatsnew/3.8.html#changes-in-python-behavior) on the flake8 F632 issue raised below.

[flake8](http://flake8.pycqa.org) testing of https://github.com/spulec/moto on Python 3.7.1

$ __flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics__
```
./tests/test_awslambda/test_lambda.py:1137:24: F632 use ==/!= to compare str, bytes, and int literals
                assert len(messages) is 3
                       ^
1     F632 use ==/!= to compare str, bytes, and int literals
1
```
2019-10-18 09:03:31 +02:00
Steve Pulec
31198c75b8
Merge pull request #2457 from bblommers/feature/dynamodb_streams_invoke_lambda
Feature: Add option for DynamoDB stream to kick off lambda
2019-10-10 17:05:43 -05:00
Seth Black
dff24cb032 bringing up test percentage 2019-10-09 16:20:53 -05:00
Seth Black
20dc8ae5c4 getting tests working in server mode 2019-10-09 15:15:10 -05:00
Seth Black
41af98c98b added UpdateFunctionCode and UpdateFunctionConfiguration and associated test cases 2019-10-08 15:59:03 -05:00
Bert Blommers
91b13f998f Feature: Add option for DynamoDB stream to kick off lambda 2019-10-07 11:11:22 +01:00
Randy Westergren
ccceb70397
And event source mapping endpoints and SQS trigger support 2019-08-20 21:54:57 -04:00
cm-iwata
8f4c273095 fix #2190 (#2194)
lambda list_versions_by_function return $LATEST version and published version
2019-05-21 17:49:56 +01:00
Tomoya Iwata
52ad71879d modified test code for python2.7 2019-03-29 15:52:47 +09:00
Tomoya Iwata
11ff548d14 fix #2113
moto must return Http status code 201 when lambda publish_version has succeeded
2019-03-17 17:54:34 +09:00
William Rubel
37845e41a6 Trying to improve coverage 2019-02-18 09:44:48 -06:00
William Rubel
e229d248ad Trying to improve coverage 2019-02-18 08:52:37 -06:00
William Rubel
8048e39dc0 Fix policy date 2019-02-17 22:32:39 -06:00
William Rubel
921a993330 cleaning up files 2019-02-17 14:30:43 -06:00
William Rubel
5372e6840f Increasing code coverage 2019-02-16 12:37:46 -06:00
William Rubel
4c6f08d463 Update kms and lambda to work with terraform 2019-02-16 09:27:23 -06:00
Alexander Mohr
941d817da4 fix lambda endpoint parsing (#1395)
* fix endpoint parsing

* add new unittest

* finish test
2018-03-21 22:14:10 -07:00
Terry Cain
d5ee48eedd
Lambda improvements (#1344)
* Revamped the lambda function storage to do versioning.

* Flake8

* .

* Fixes

* Swapped around an if
2017-11-26 21:28:28 +00:00
Terry Cain
62a2d8f756
Improved lambda timings 2017-10-25 20:04:00 +01:00
Chris Keogh
9bb07e6b6e add awslambda.add_permission 2017-10-03 20:02:23 +13:00
Chris Keogh
b994cf5291 add more realistic policy 2017-10-03 14:52:00 +13:00
Chris Keogh
fc9c250922 add basic awslambda get_policy 2017-10-03 13:33:50 +13:00
Alexander Mohr
9008b85299 lambda + SNS enhancements (#1048)
* updates

- support lambda messages from SNS
- run lambda in docker container

* decode output

* populate timeout

* simplify

* whoops

* skeletons of cloudwatchlogs

* impl filter log streams

* fix logging

* PEP fixes

* PEP fixes

* fix reset

* fix reset

* add new endpoint

* fix region name

* add docker

* try to fix tests

* try to fix travis issue with boto

* fix escaping in urls

* fix environment variables

* fix PEP

* more pep

* switch back to precise

* another fix attempt

* fix typo

* fix lambda invoke

* fix more unittests

* work on getting this to work in new scheme

* fix py2

* fix error

* fix tests when running in server mode

* more lambda fixes

* try running with latest docker

adapted from aiodocker

* switch to docker python client

* pep fixes

* switch to docker volume

* fix unittest

* fix invoke from sns

* fix zip2tar

* add hack impl for get_function with zip

* try fix

* fix for py < 3.6

* add volume refcount

* try to fix travis

* docker test

* fix yaml

* try fix

* update endpoints

* fix

* another attempt

* try again

* fix recursive import

* refactor fix

* revert changes with better fix

* more reverts

* wait for service to come up

* add back detached mode

* sleep and add another exception type

* put this back for logging

* put back with note

* whoops :)

* docker in docker!

* fix invalid url

* hopefully last fix!

* fix lambda regions

* fix protocol

* travis!!!!

* just run lambda test for now

* use one print

* fix escaping

* another attempt

* yet another

* re-enable all tests

* fixes

* fix for py2

* revert change

* fix for py2.7

* fix output ordering

* remove this given there's a new unittest that covers it

* changes based on review

- add skeleton logs test file
- switch to docker image that matches test env
- fix mock_logs import

* add readme entry
2017-09-27 16:04:58 -07:00
Chris Keogh
101dfaa412 fix tests for python 3.x 2017-09-15 15:41:48 +12:00
Chris Keogh
2c8326e9b9 allow get_function for lambda created with zipfile 2017-09-15 14:49:32 +12:00
Chris Keogh
c20d365021 fix merge conflicts 2017-09-14 14:30:55 +12:00
Chris Keogh
a379d76cfc add aws_lamba.invoke_async method 2017-09-14 13:59:35 +12:00
aohara-admin
98f95dd4a7 add Lambda tag_resource, untag_resource, and list_tags methods 2017-09-13 15:41:49 -04:00
Steve Pulec
e7a3f3408e Add Lambda header for invoking error. Closes #770. 2017-03-16 22:00:57 -04:00
Steve Pulec
cda553abfb Change tests to use default server port of 5000. 2017-03-12 21:04:19 -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
Rob Walker
ed0e81fc61 Fixup lambda for ResponseRequest (#781)
* Fixup lambda for ResponseRequest

* one day will get this right
2016-12-03 18:17:15 -05:00
rocky4570fft
dc98cf6f64 argh 2 days trying to work python3 into working python2 :( 2016-10-10 01:13:52 +10:00
rocky4570fft
7c3005e582 attmpt 2 to resolve StringIO not being within Python 3 anymore 2016-10-07 00:14:47 +10:00
rocky4570fft
6c577091da lambderize the moto lambda 2016-10-06 19:52:23 +10:00
Steve Pulec
ae938223d4 Cleanup headers popping. 2016-07-24 09:50:39 -04:00
Steve Pulec
8e8f3d99f6 Merge pull request #655 from 2rs2ts/work-around-httpheaders
Remove HTTPHeaders from ResponseMetadata in some tests
2016-07-24 09:36:58 -04:00
Andrew Garrett
aab137ae66 Remove HTTPHeaders from ResponseMetadata in some tests
botocore 1.4.29 started adding this. I'd match against it, but it
contains a date object and it's just not worth rewriting the assertions
for a key-by-key approach.
2016-06-29 23:45:21 +00:00
Mike Grima
bfa079ec4e Added Lambda invoke capability. 2016-06-22 12:24:46 -07:00
Hugo Lopes Tavares
8f586d8637 [lambda] Use S3Key to figure out code size and SHA256 2016-02-17 16:24:17 -05:00
Hugo Lopes Tavares
b8d8844286 [lambda] Renamed test file to follow the convention 2016-02-17 16:16:50 -05:00