1{ lib, buildPythonPackage, fetchPypi, isPy27, fetchpatch
2, aws-xray-sdk
3, backports_tempfile
4, boto
5, boto3
6, botocore
7, cfn-lint
8, docker
9, flask
10, freezegun
11, jinja2
12, jsondiff
13, mock
14, nose
15, pyaml
16, python-jose
17, pytz
18, requests
19, responses
20, six
21, sshpubkeys
22, sure
23, werkzeug
24, xmltodict
25, parameterized
26, idna
27}:
28
29buildPythonPackage rec {
30 pname = "moto";
31 version = "1.3.14";
32
33 src = fetchPypi {
34 inherit pname version;
35 sha256 = "0fm09074qic24h8rw9a0paklygyb7xd0ch4890y4v8lj2pnsxbkr";
36 };
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace "jsondiff==1.1.2" "jsondiff~=1.1"
41 sed -i '/datetime/d' setup.py # should be taken care of by std library
42 '';
43
44 patches = [
45 # loosen idna upper limit
46 (fetchpatch {
47 url = "https://github.com/spulec/moto/commit/649b497f71cce95a6474a3ff6f3c9c3339efb68f.patch";
48 sha256 = "03qdybzlskgbdadmlcg6ayxfp821b5iaa8q2542cwkcq7msqbbqc";
49 })
50 ];
51
52 propagatedBuildInputs = [
53 aws-xray-sdk
54 boto
55 boto3
56 botocore
57 cfn-lint
58 docker
59 flask # required for server
60 jinja2
61 jsondiff
62 mock
63 pyaml
64 python-jose
65 pytz
66 six
67 requests
68 responses
69 sshpubkeys
70 werkzeug
71 xmltodict
72 idna
73 ] ++ lib.optionals isPy27 [ backports_tempfile ];
74
75 checkInputs = [ boto3 freezegun nose sure parameterized ];
76
77 checkPhase = ''
78 nosetests -v ./tests/ \
79 -e test_invoke_function_from_sns \
80 -e test_invoke_requestresponse_function \
81 -e test_context_manager \
82 -e test_decorator_start_and_stop \
83 -e test_invoke_event_function \
84 -e test_invoke_function_from_dynamodb \
85 -e test_invoke_function_from_sqs \
86 -e test_invoke_lambda_error \
87 -e test_invoke_async_function \
88 -e test_passthrough_requests
89 '';
90
91 # Disabling because of 20 failing tests due to https://github.com/spulec/moto/issues/2728
92 # We should enable these as soon as possible again though. Note the issue
93 # is unrelated to the docutils 0.16 bump.
94 doCheck = false;
95
96 meta = with lib; {
97 description = "Allows your tests to easily mock out AWS Services";
98 homepage = "https://github.com/spulec/moto";
99 license = licenses.asl20;
100 maintainers = [ ];
101 };
102}