apx-aws-lambda 0.3.5__tar.gz → 0.3.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/PKG-INFO +3 -3
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/README.md +2 -2
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/lambda_.py +43 -15
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/proxy.py +2 -2
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda.egg-info/PKG-INFO +3 -3
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/pyproject.toml +1 -1
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/tests/test_proxy.py +107 -8
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/tests/test_targets.py +2 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/LICENSE +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/__init__.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/cli.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/Makefile +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/lambda_handler.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/tools/lambda_requirements.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/overlays/index.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/plugin.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/shell.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda/tools.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda.egg-info/requires.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/apx_aws_lambda.egg-info/top_level.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.7
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -51,7 +51,7 @@ action-platform diagnose
|
|
|
51
51
|
| Deploy | `sam build` + `sam deploy --config-env <stage>` (`dev` → `default`, `prod` → `prod`) |
|
|
52
52
|
| Rollback | CloudFormation `rollback-stack` — previous stack state |
|
|
53
53
|
| Diagnose | stack status and the HTTP API url |
|
|
54
|
-
| Destroy | `sam delete` |
|
|
54
|
+
| Destroy | `sam delete` of the stage's stack; when no stage is left, the app leaves the proxy too (roles and grant) — the token must carry `org.manage`, which a platform deploy by an organization manager does |
|
|
55
55
|
| Tools | `aws_lambda_stacks`, `aws_lambda_functions` |
|
|
56
56
|
| Commands | `action-platform aws-lambda stacks\|functions`, `action-platform aws-lambda proxy …` |
|
|
57
57
|
|
|
@@ -110,7 +110,7 @@ proxy_url = "https://xxxx.lambda-url.us-east-1.on.aws"
|
|
|
110
110
|
app = "acme/shop/orders"
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Through the proxy the stack is named `ap-acme-shop-orders-dev` / `-prod` — the deploy role reaches that prefix only, so the target sets `--stack-name` itself and `stack_name` in `samconfig.toml` is ignored; the repository never has to know the organization.
|
|
114
114
|
|
|
115
115
|
**4.** `action-platform deploy`.
|
|
116
116
|
|
|
@@ -31,7 +31,7 @@ action-platform diagnose
|
|
|
31
31
|
| Deploy | `sam build` + `sam deploy --config-env <stage>` (`dev` → `default`, `prod` → `prod`) |
|
|
32
32
|
| Rollback | CloudFormation `rollback-stack` — previous stack state |
|
|
33
33
|
| Diagnose | stack status and the HTTP API url |
|
|
34
|
-
| Destroy | `sam delete` |
|
|
34
|
+
| Destroy | `sam delete` of the stage's stack; when no stage is left, the app leaves the proxy too (roles and grant) — the token must carry `org.manage`, which a platform deploy by an organization manager does |
|
|
35
35
|
| Tools | `aws_lambda_stacks`, `aws_lambda_functions` |
|
|
36
36
|
| Commands | `action-platform aws-lambda stacks\|functions`, `action-platform aws-lambda proxy …` |
|
|
37
37
|
|
|
@@ -90,7 +90,7 @@ proxy_url = "https://xxxx.lambda-url.us-east-1.on.aws"
|
|
|
90
90
|
app = "acme/shop/orders"
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Through the proxy the stack is named `ap-acme-shop-orders-dev` / `-prod` — the deploy role reaches that prefix only, so the target sets `--stack-name` itself and `stack_name` in `samconfig.toml` is ignored; the repository never has to know the organization.
|
|
94
94
|
|
|
95
95
|
**4.** `action-platform deploy`.
|
|
96
96
|
|
|
@@ -6,6 +6,7 @@ from __future__ import annotations
|
|
|
6
6
|
|
|
7
7
|
import os
|
|
8
8
|
import tomllib
|
|
9
|
+
from dataclasses import replace
|
|
9
10
|
|
|
10
11
|
from action_platform.abc import DeployTarget
|
|
11
12
|
from action_platform.core.context import Context, DeployResult, Diagnosis
|
|
@@ -13,7 +14,7 @@ from action_platform.core.exception import ActionPlatformError, DeployError
|
|
|
13
14
|
from action_platform.remote.client import Remote
|
|
14
15
|
|
|
15
16
|
from apx_aws_lambda import shell
|
|
16
|
-
from apx_aws_lambda.proxy import ProxyClient
|
|
17
|
+
from apx_aws_lambda.proxy import ProxyClient, ProxyRefused
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class LambdaTarget(DeployTarget):
|
|
@@ -89,6 +90,12 @@ class LambdaTarget(DeployTarget):
|
|
|
89
90
|
return tomllib.loads(path.read_text())
|
|
90
91
|
|
|
91
92
|
def _stack(self, ctx: Context) -> str:
|
|
93
|
+
"""The stack: `<prefix>-<stage>` when the proxy granted a prefix — the repository's samconfig.toml never has to know the organization — else samconfig.toml's `stack_name`."""
|
|
94
|
+
prefix = (self.env(ctx) or {}).get("AP_STACK_PREFIX")
|
|
95
|
+
|
|
96
|
+
if prefix:
|
|
97
|
+
return f"{prefix}-{'prod' if ctx.stage == 'prod' else 'dev'}"
|
|
98
|
+
|
|
92
99
|
params = (
|
|
93
100
|
self._samconfig(ctx)
|
|
94
101
|
.get(self._stage(ctx), {})
|
|
@@ -138,15 +145,8 @@ class LambdaTarget(DeployTarget):
|
|
|
138
145
|
"template.yaml not found: apply the aws/lambda overlay first"
|
|
139
146
|
)
|
|
140
147
|
|
|
141
|
-
|
|
148
|
+
self._stack(ctx)
|
|
142
149
|
env = self.env(ctx)
|
|
143
|
-
prefix = (env or {}).get("AP_STACK_PREFIX")
|
|
144
|
-
|
|
145
|
-
if prefix and not stack.startswith(prefix):
|
|
146
|
-
raise DeployError(
|
|
147
|
-
f"stack_name {stack!r} must start with {prefix!r}: the proxy grants deploy on that prefix only"
|
|
148
|
-
)
|
|
149
|
-
|
|
150
150
|
shell.aws("sts", "get-caller-identity", region=self._region(ctx), env=env)
|
|
151
151
|
shell.run(
|
|
152
152
|
[*shell.require("sam", ""), "validate", "--lint"],
|
|
@@ -164,6 +164,8 @@ class LambdaTarget(DeployTarget):
|
|
|
164
164
|
"deploy",
|
|
165
165
|
"--no-confirm-changeset",
|
|
166
166
|
"--no-fail-on-empty-changeset",
|
|
167
|
+
"--stack-name",
|
|
168
|
+
self._stack(ctx),
|
|
167
169
|
]
|
|
168
170
|
|
|
169
171
|
if stage != "default":
|
|
@@ -232,14 +234,40 @@ class LambdaTarget(DeployTarget):
|
|
|
232
234
|
)
|
|
233
235
|
|
|
234
236
|
def delete(self, ctx: Context) -> None:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
"""The stage's stack goes; once no stage is left, the app leaves the proxy too — its roles and grant — when the token may (`org.manage`)."""
|
|
238
|
+
if self.diagnose(ctx).status != "missing":
|
|
239
|
+
sam = shell.require("sam", "pip install aws-sam-cli")
|
|
240
|
+
args = [*sam, "delete", "--no-prompts", "--stack-name", self._stack(ctx)]
|
|
241
|
+
region = self._region(ctx)
|
|
242
|
+
|
|
243
|
+
if region:
|
|
244
|
+
args += ["--region", region]
|
|
245
|
+
|
|
246
|
+
shell.run(args, cwd=ctx.repo_root, env=self.env(ctx))
|
|
247
|
+
|
|
248
|
+
proxy = self.proxy(ctx)
|
|
249
|
+
|
|
250
|
+
if proxy is None or self._other_stage_lives(ctx):
|
|
251
|
+
return
|
|
252
|
+
|
|
253
|
+
try:
|
|
254
|
+
proxy.delete(token=proxy.token(ctx))
|
|
255
|
+
except ProxyRefused as e:
|
|
256
|
+
if e.status == 404:
|
|
257
|
+
return
|
|
258
|
+
|
|
259
|
+
if e.status == 403:
|
|
260
|
+
raise DeployError(
|
|
261
|
+
f"the stacks are gone but the proxy still knows {proxy.app} ({e.detail}): "
|
|
262
|
+
"delete as an organization manager, or run `action-platform aws-lambda proxy delete`"
|
|
263
|
+
) from e
|
|
264
|
+
|
|
265
|
+
raise
|
|
238
266
|
|
|
239
|
-
|
|
240
|
-
|
|
267
|
+
def _other_stage_lives(self, ctx: Context) -> bool:
|
|
268
|
+
other = replace(ctx, stage="dev" if ctx.stage == "prod" else "prod")
|
|
241
269
|
|
|
242
|
-
|
|
270
|
+
return self.diagnose(other).status != "missing"
|
|
243
271
|
|
|
244
272
|
def _url(self, ctx: Context) -> str | None:
|
|
245
273
|
try:
|
|
@@ -100,8 +100,8 @@ class ProxyClient:
|
|
|
100
100
|
def show(self) -> dict:
|
|
101
101
|
return self._call("GET", f"/apps/{self.app}", token=self.token())
|
|
102
102
|
|
|
103
|
-
def delete(self) -> dict:
|
|
104
|
-
return self._call("DELETE", f"/apps/{self.app}", token=self.token())
|
|
103
|
+
def delete(self, token: str | None = None) -> dict:
|
|
104
|
+
return self._call("DELETE", f"/apps/{self.app}", token=token or self.token())
|
|
105
105
|
|
|
106
106
|
def grant(self, subjects: list[str]) -> dict:
|
|
107
107
|
return self._call(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.7
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -51,7 +51,7 @@ action-platform diagnose
|
|
|
51
51
|
| Deploy | `sam build` + `sam deploy --config-env <stage>` (`dev` → `default`, `prod` → `prod`) |
|
|
52
52
|
| Rollback | CloudFormation `rollback-stack` — previous stack state |
|
|
53
53
|
| Diagnose | stack status and the HTTP API url |
|
|
54
|
-
| Destroy | `sam delete` |
|
|
54
|
+
| Destroy | `sam delete` of the stage's stack; when no stage is left, the app leaves the proxy too (roles and grant) — the token must carry `org.manage`, which a platform deploy by an organization manager does |
|
|
55
55
|
| Tools | `aws_lambda_stacks`, `aws_lambda_functions` |
|
|
56
56
|
| Commands | `action-platform aws-lambda stacks\|functions`, `action-platform aws-lambda proxy …` |
|
|
57
57
|
|
|
@@ -110,7 +110,7 @@ proxy_url = "https://xxxx.lambda-url.us-east-1.on.aws"
|
|
|
110
110
|
app = "acme/shop/orders"
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Through the proxy the stack is named `ap-acme-shop-orders-dev` / `-prod` — the deploy role reaches that prefix only, so the target sets `--stack-name` itself and `stack_name` in `samconfig.toml` is ignored; the repository never has to know the organization.
|
|
114
114
|
|
|
115
115
|
**4.** `action-platform deploy`.
|
|
116
116
|
|
|
@@ -58,7 +58,7 @@ class FakeProxy:
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
class
|
|
61
|
+
class ProxyCase(unittest.TestCase):
|
|
62
62
|
def setUp(self):
|
|
63
63
|
self.tmp = TemporaryDirectory()
|
|
64
64
|
self.root = Path(self.tmp.name)
|
|
@@ -72,6 +72,8 @@ class ProxyClientTest(unittest.TestCase):
|
|
|
72
72
|
identity=(lambda audience: f"{token}:{audience}") if token else None,
|
|
73
73
|
)
|
|
74
74
|
|
|
75
|
+
|
|
76
|
+
class ProxyClientTest(ProxyCase):
|
|
75
77
|
def test_env_carries_credentials_from_the_grant(self):
|
|
76
78
|
fake = FakeProxy({"POST /apps/acme/shop/orders/credentials": GRANTED})
|
|
77
79
|
|
|
@@ -207,24 +209,31 @@ class ProxyClientTest(unittest.TestCase):
|
|
|
207
209
|
with self.assertRaises(DeployError):
|
|
208
210
|
ProxyClient("https://proxy.test", "orders")
|
|
209
211
|
|
|
210
|
-
def
|
|
212
|
+
def test_the_stack_follows_the_prefix_the_proxy_granted(self):
|
|
211
213
|
(self.root / "samconfig.toml").write_text(SAMCONFIG.format(stack="shop-dev"))
|
|
212
214
|
(self.root / "template.yaml").write_text("Resources: {}\n")
|
|
213
215
|
fake = FakeProxy({"POST /apps/acme/shop/orders/credentials": GRANTED})
|
|
214
216
|
target = LambdaTarget(proxy_url="https://proxy.test", app="acme/shop/orders")
|
|
217
|
+
calls: list[list[str]] = []
|
|
218
|
+
|
|
219
|
+
def run(args, cwd=None, env=None):
|
|
220
|
+
calls.append(args)
|
|
221
|
+
|
|
222
|
+
return "{}"
|
|
215
223
|
|
|
216
224
|
with (
|
|
217
225
|
mock.patch("urllib.request.urlopen", fake),
|
|
218
226
|
mock.patch.multiple(
|
|
219
|
-
shell,
|
|
220
|
-
run=lambda *a, **k: "{}",
|
|
221
|
-
require=lambda tool, hint: [f"/usr/bin/{tool}"],
|
|
227
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
222
228
|
),
|
|
223
229
|
):
|
|
224
|
-
|
|
225
|
-
|
|
230
|
+
target.preflight(self.ctx())
|
|
231
|
+
target.deploy(self.ctx())
|
|
226
232
|
|
|
227
|
-
|
|
233
|
+
deploy = next(c for c in calls if c[1] == "deploy")
|
|
234
|
+
self.assertEqual(
|
|
235
|
+
deploy[deploy.index("--stack-name") + 1], "ap-acme-shop-orders-dev"
|
|
236
|
+
)
|
|
228
237
|
|
|
229
238
|
def test_the_target_deploys_with_the_granted_credentials(self):
|
|
230
239
|
(self.root / "samconfig.toml").write_text(
|
|
@@ -261,3 +270,93 @@ class ProxyClientTest(unittest.TestCase):
|
|
|
261
270
|
"ExecutionRoleArn=arn:aws:iam::1:role/action-platform/ap-exec-acme-shop-orders",
|
|
262
271
|
],
|
|
263
272
|
)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class DeleteTest(ProxyCase):
|
|
276
|
+
def run_with(self, live: set[str]):
|
|
277
|
+
calls: list[list[str]] = []
|
|
278
|
+
|
|
279
|
+
def run(args, cwd=None, env=None):
|
|
280
|
+
calls.append(args)
|
|
281
|
+
|
|
282
|
+
if args[1:3] == ["cloudformation", "describe-stacks"]:
|
|
283
|
+
stack = args[args.index("--stack-name") + 1]
|
|
284
|
+
|
|
285
|
+
if stack not in live:
|
|
286
|
+
raise DeployError("does not exist")
|
|
287
|
+
|
|
288
|
+
return json.dumps({"Stacks": [{"StackStatus": "UPDATE_COMPLETE"}]})
|
|
289
|
+
|
|
290
|
+
if args[1] == "delete":
|
|
291
|
+
live.discard(args[args.index("--stack-name") + 1])
|
|
292
|
+
|
|
293
|
+
return "{}"
|
|
294
|
+
|
|
295
|
+
return calls, run
|
|
296
|
+
|
|
297
|
+
def test_delete_drops_the_stage_and_leaves_the_proxy_while_another_stage_lives(
|
|
298
|
+
self,
|
|
299
|
+
):
|
|
300
|
+
(self.root / "samconfig.toml").write_text(SAMCONFIG.format(stack="x"))
|
|
301
|
+
fake = FakeProxy({"POST /apps/acme/shop/orders/credentials": GRANTED})
|
|
302
|
+
target = LambdaTarget(proxy_url="https://proxy.test", app="acme/shop/orders")
|
|
303
|
+
calls, run = self.run_with(
|
|
304
|
+
{"ap-acme-shop-orders-dev", "ap-acme-shop-orders-prod"}
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
with (
|
|
308
|
+
mock.patch("urllib.request.urlopen", fake),
|
|
309
|
+
mock.patch.multiple(
|
|
310
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
311
|
+
),
|
|
312
|
+
):
|
|
313
|
+
target.delete(self.ctx())
|
|
314
|
+
|
|
315
|
+
deleted = next(c for c in calls if c[1] == "delete")
|
|
316
|
+
self.assertEqual(
|
|
317
|
+
deleted[deleted.index("--stack-name") + 1], "ap-acme-shop-orders-dev"
|
|
318
|
+
)
|
|
319
|
+
self.assertNotIn("DELETE", [r[0] for r in fake.requests])
|
|
320
|
+
|
|
321
|
+
def test_delete_of_the_last_stage_deregisters_the_app(self):
|
|
322
|
+
(self.root / "samconfig.toml").write_text(SAMCONFIG.format(stack="x"))
|
|
323
|
+
fake = FakeProxy(
|
|
324
|
+
{
|
|
325
|
+
"POST /apps/acme/shop/orders/credentials": GRANTED,
|
|
326
|
+
"DELETE /apps/acme/shop/orders": {"deleted": True},
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
target = LambdaTarget(proxy_url="https://proxy.test", app="acme/shop/orders")
|
|
330
|
+
calls, run = self.run_with({"ap-acme-shop-orders-dev"})
|
|
331
|
+
|
|
332
|
+
with (
|
|
333
|
+
mock.patch("urllib.request.urlopen", fake),
|
|
334
|
+
mock.patch.multiple(
|
|
335
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
336
|
+
),
|
|
337
|
+
):
|
|
338
|
+
target.delete(self.ctx())
|
|
339
|
+
|
|
340
|
+
self.assertEqual(
|
|
341
|
+
[r[:2] for r in fake.requests if r[0] == "DELETE"],
|
|
342
|
+
[("DELETE", "/apps/acme/shop/orders")],
|
|
343
|
+
)
|
|
344
|
+
self.assertEqual(len([c for c in calls if c[1] == "delete"]), 1)
|
|
345
|
+
|
|
346
|
+
def test_delete_without_org_manage_says_who_can_finish(self):
|
|
347
|
+
(self.root / "samconfig.toml").write_text(SAMCONFIG.format(stack="x"))
|
|
348
|
+
fake = FakeProxy({"POST /apps/acme/shop/orders/credentials": GRANTED})
|
|
349
|
+
target = LambdaTarget(proxy_url="https://proxy.test", app="acme/shop/orders")
|
|
350
|
+
calls, run = self.run_with(set())
|
|
351
|
+
|
|
352
|
+
with (
|
|
353
|
+
mock.patch("urllib.request.urlopen", fake),
|
|
354
|
+
mock.patch.multiple(
|
|
355
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
356
|
+
),
|
|
357
|
+
):
|
|
358
|
+
with self.assertRaises(DeployError) as caught:
|
|
359
|
+
target.delete(self.ctx())
|
|
360
|
+
|
|
361
|
+
self.assertIn("organization manager", str(caught.exception))
|
|
362
|
+
self.assertEqual([c for c in calls if c[1] == "delete"], [])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|