Commit Graph

64 Commits

Author SHA1 Message Date
David Baumgold
3af87963d1
Py3: use unittest.mock instead of mock (#3481)
* Py3: use unittest.mock instead of mock

* noqa

* oops

* just pull in patch()

* ignore RuntimeError when stopping patch

* ignore RuntimeError from default_session_mock.stop()
2021-04-06 10:22:42 +01:00
Anton Grübel
6da4905da9
Fix AttributeNames for sqs.receive_message (#3736)
* Fix AttributeNames for sqs.receive_message

* Fix Lambda issue

* Change to parametrized tests

* Simplify attribute logic
2021-03-05 10:42:07 +00:00
Bert Blommers
d7b8419791
Fix Mock 4.0.3 compatibility - Unpatch only once during teardown (#3541)
* #3535 - Unpatch only once during teardown

* EnvVar patching - Fix Python2 bug

* Allow latest version of mock-library
2021-02-15 08:42:16 +00:00
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
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
Karthikeyan Singaravelan
7054143701
Fix deprecation warnings due to invalid escape sequences. (#3273)
* Fix deprecation warnings due to invalid escape sequences.

* Fix linter error.
2020-09-10 09:20:26 +01:00
Bert Blommers
7b5613b331 #2774 - Re-add test, and update requirements to working botocore 2020-03-09 12:47:44 +00:00
Bert Blommers
c6b66cb001 Linting 2020-03-05 17:22:54 +00:00
Bert Blommers
b19cf8a085 #2774 - Run Policy test on different method 2020-03-05 15:49:30 +00:00
Mike Grima
11b7be0e85 Implemented S3 Account-level public access block.
- Also added AWS Config listing and fetching support
- Also fixed Lambda test breakage
2020-02-17 15:41:27 -08:00
Fabio Dias
fd9ac4b9a5 ACCOUNT_ID moved to moto.core, MOTO_ACCOUNT_ID env var override 2019-12-16 21:05:29 -05:00
Mike Grima
84ccdbd1cd Implemented S3 Public Access Block 2019-12-12 17:45:31 -08:00
Bert Blommers
e025ccfd06 Ensure IAM Policy names are unique in tests 2019-11-16 17:36:50 +00:00
Ian Yon
f235fa145e Added Exception for create_policy when policy exists 2019-11-05 15:57:38 -03:00
Asher Foa
96e5b1993d Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
Steve Pulec
aa896a0c2e
Merge pull request #2294 from spulec/fix-responses-mocking
Cleanup responses mocking. Closes #1567
2019-09-11 22:06:36 -05:00
acsbendi
cf2dae0ce8 Calling sts:GetCallerIdentity is always allowed. 2019-08-22 18:09:52 +02:00
Steve Pulec
69d86cbd54
Merge pull request #2300 from acsbendi/master
Basic IAM authentication, authorization
2019-07-28 17:22:52 -05:00
acsbendi
62b25f9914 Added a few more tests to achieve better coverage. 2019-07-28 22:19:50 +02:00
acsbendi
cc843bb8c5 Created tests for IAM auth. 2019-07-26 20:40:15 +02:00
Steve Pulec
4dd2b66b04 Refactor backend parsing. 2019-07-21 22:07:58 -05:00
Steve Pulec
2a0df1e1a8 Flip when we test passthru. 2019-07-11 10:09:01 -05:00
Steve Pulec
11506e21d5 Only test passthrough exception in non-server mode. 2019-07-10 22:45:26 -05:00
Steve Pulec
c7147b06b1 Cleanup responses mocking. Closes #1567
This unblocks requests to other websites with requests while Moto
is activated. It also adds a wildcard for AWS services to still
ensure no accidental requests are made for unmocked services
2019-07-10 21:59:25 -05:00
Steve Pulec
c2e382f537 Dont test context manager in server mode. 2019-07-10 21:40:49 -05:00
Steve Pulec
b19c201975 Cleanup model ref resetting. 2019-07-10 21:16:11 -05:00
Steve Pulec
308712841c Have context manager return mock. 2019-07-09 20:31:43 -05:00
Cory Dolphin
f11a5dcf6b Fix socket.fakesock compatibility 2019-07-03 11:26:33 -07:00
Garrett
c739c5331e Handle UnicodeEncodeError when parsing querystring (#2170) 2019-05-25 18:34:47 +01:00
Ollie Ford
28aa5d34b0
Add failing test for #1809 2018-09-05 11:31:47 +01:00
Steve Pulec
25e2af0320 Fix camelcase_to_underscore. Closes #767. 2017-03-15 23:39:36 -04:00
Steve Pulec
cda553abfb Change tests to use default server port of 5000. 2017-03-12 21:04:19 -04:00
Steve Pulec
1709208872 First version of dashboard. 2017-03-11 22:45:42 -05: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
51df02e7cf Cleanup Server host parsing. 2017-02-20 14:31:19 -05:00
Steve Pulec
fde721bed7 Testing new version of decorator. 2017-02-15 22:35:45 -05:00
Taro Sato
7cd404808b Better EMR coverage and boto3 request/response handling
This revision includes:

- A handler for requests for which content-type is JSON (from boto3).

- A decorator (generate_boto3_response) to convert XML responses to
  JSON (for boto3). This way, existing response templates for boto can
  be shared for generating boto3 response.

- Utility class/functions to use botocore's service specification data
  (accessible under botocore.data) for type casting, from query
  parameters to Python objects and XML to JSON.

- Updates to response handlers/models to cover more EMR end points and
  mockable parameters
2016-10-13 16:48:07 -07:00
Michael De La Rue
9062c654cf Hopefully break build by testing for local only default server 2016-09-01 12:05:34 +01:00
Steve Pulec
705ec314a3 Cleanup different places using unix_time() 2015-11-27 14:14:40 -05:00
Jean-Baptiste Barth
a06f8b15f5 Add moto.core.utils.underscores_to_camelcase() 2015-11-23 14:09:31 +01:00
Jean-Baptiste Barth
a4dfdc8274 Add basic tests for moto.core.utils.camelcase_to_underscores() 2015-11-23 14:04:14 +01:00
Steve Pulec
3ed9428cb0 Cleanup class decorator. Closes #363. 2015-06-27 19:01:01 -04:00
Konstantinos Koukopoulos
86cba4e82c create a new connection after exiting context manager in test_decorator_calls 2015-02-20 21:39:26 +02:00
Steve Pulec
828ed13bde Allow for class-based decorator. Closes #157 2014-11-16 19:05:28 -05:00
Joseph Lawson
cb88b8783d raise NotImplementedError on unknown metadata path 2014-10-15 13:43:38 -04:00
David Baumgold
eedb4c4b73 Support Python 3 using six 2014-08-28 10:57:43 -04:00