mockstack 0.5.1__tar.gz → 0.5.2__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.
- {mockstack-0.5.1 → mockstack-0.5.2}/PKG-INFO +1 -1
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/display.py +2 -2
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/strategies/create_mixin.py +14 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/strategies/filefixtures.py +1 -1
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/strategies/proxyrules.py +5 -4
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/test_display.py +1 -1
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack.egg-info/PKG-INFO +1 -1
- {mockstack-0.5.1 → mockstack-0.5.2}/.env.example +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/.github/workflows/ci.yml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/.github/workflows/publish-docs.yml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/.github/workflows/publish-to-pypi.yml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/.gitignore +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/.pre-commit-config.yaml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/CODE_OF_CONDUCT.md +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/LICENSE +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/README.md +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/SECURITY.md +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/docs/assets/favicon.ico +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/docs/assets/logo.png +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/docs/assets/mockstack.png +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/filefixtures-with-templates/.env.example +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/filefixtures-with-templates/README.md +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/filefixtures-with-templates/templates/servicename-api-v1-items.j2 +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/filefixtures-with-templates/templates/servicename2-api-v2-user.533ec889-7c68-45c8-b21e-4a7e455d1234.j2 +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/proxyrules-with-rules-file/.env.example +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/proxyrules-with-rules-file/README.md +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/examples/proxyrules-with-rules-file/rules.yml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mkdocs.yml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/__init__.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/config.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/constants.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/identifiers.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/intent.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/lifespan.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/main.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/middleware.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/routers/__init__.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/routers/catchall.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/routers/homepage.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/strategies/__init__.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/strategies/base.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/strategies/factory.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/telemetry.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/templating.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/__init__.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/conftest.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/fixtures/proxyrules.yml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/fixtures/templates/__init__.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/routers/__init__.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/routers/test_catchall.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/routers/test_homepage.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/strategies/test_filefixtures.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/strategies/test_proxyrules.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/test_identifiers.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/test_middleware.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack/tests/test_templating.py +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack.egg-info/SOURCES.txt +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack.egg-info/dependency_links.txt +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack.egg-info/entry_points.txt +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack.egg-info/requires.txt +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/mockstack.egg-info/top_level.txt +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/pyproject.toml +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/setup.cfg +0 -0
- {mockstack-0.5.1 → mockstack-0.5.2}/uv.lock +0 -0
|
@@ -20,8 +20,8 @@ def announce(app: FastAPI, settings: Settings):
|
|
|
20
20
|
)
|
|
21
21
|
logger.info(str(app.state.strategy), extra=extra)
|
|
22
22
|
logger.info(
|
|
23
|
-
f"OpenTelemetry enabled: [medium_purple]{settings.opentelemetry.enabled}[/medium_purple]
|
|
24
|
-
f"endpoint: [medium_purple]{settings.opentelemetry.endpoint}[/medium_purple]
|
|
23
|
+
f"[medium_purple]OpenTelemetry[/medium_purple] enabled: [medium_purple]{settings.opentelemetry.enabled}[/medium_purple],\n "
|
|
24
|
+
f"endpoint: [medium_purple]{settings.opentelemetry.endpoint}[/medium_purple],\n "
|
|
25
25
|
f"capture_response_body: [medium_purple]{settings.opentelemetry.capture_response_body}[/medium_purple]",
|
|
26
26
|
extra=extra,
|
|
27
27
|
)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
from uuid import uuid4
|
|
5
|
+
import json
|
|
5
6
|
|
|
6
7
|
from fastapi import Request, Response, status
|
|
7
8
|
from fastapi.responses import JSONResponse
|
|
@@ -16,6 +17,9 @@ class CreateMixin:
|
|
|
16
17
|
async def _create(
|
|
17
18
|
self, request: Request, *, env: Environment, created_resource_metadata: dict
|
|
18
19
|
) -> Response:
|
|
20
|
+
"""Simulate creation of a resource."""
|
|
21
|
+
self._create_mixin_update_opentelemetry(request, created_resource_metadata)
|
|
22
|
+
|
|
19
23
|
if wants_json(request):
|
|
20
24
|
# We return a 201 CREATED response with the resource as the body,
|
|
21
25
|
# potentially injecting the resource ID into the response.
|
|
@@ -79,3 +83,13 @@ class CreateMixin:
|
|
|
79
83
|
"uuid4": uuid4,
|
|
80
84
|
"request": request,
|
|
81
85
|
}
|
|
86
|
+
|
|
87
|
+
def _create_mixin_update_opentelemetry(
|
|
88
|
+
self, request: Request, created_resource_metadata: dict
|
|
89
|
+
) -> None:
|
|
90
|
+
"""Update the opentelemetry span with the create mixin details."""
|
|
91
|
+
span = request.state.span
|
|
92
|
+
span.set_attribute(
|
|
93
|
+
"mockstack.create_mixin.created_resource_metadata",
|
|
94
|
+
json.dumps(created_resource_metadata),
|
|
95
|
+
)
|
|
@@ -39,7 +39,7 @@ class FileFixturesStrategy(BaseStrategy, CreateMixin):
|
|
|
39
39
|
|
|
40
40
|
def __str__(self) -> str:
|
|
41
41
|
return (
|
|
42
|
-
f"[medium_purple]filefixtures[/medium_purple] "
|
|
42
|
+
f"[medium_purple]filefixtures[/medium_purple]\n "
|
|
43
43
|
f"templates_dir: [medium_purple]{self.templates_dir}[/medium_purple]. "
|
|
44
44
|
)
|
|
45
45
|
|
|
@@ -77,10 +77,11 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
77
77
|
|
|
78
78
|
def __str__(self) -> str:
|
|
79
79
|
return (
|
|
80
|
-
f"[medium_purple]proxyrules[/medium_purple] "
|
|
81
|
-
f"rules_filename:
|
|
82
|
-
f"redirect_via: [medium_purple]{self.redirect_via}[/medium_purple]
|
|
83
|
-
f"simulate_create_on_missing:
|
|
80
|
+
f"[medium_purple]proxyrules[/medium_purple]\n "
|
|
81
|
+
f"rules_filename: {self.rules_filename}.\n "
|
|
82
|
+
f"redirect_via: [medium_purple]{self.redirect_via}[/medium_purple].\n "
|
|
83
|
+
f"simulate_create_on_missing: {self.simulate_create_on_missing}.\n "
|
|
84
|
+
f"reverse_proxy_timeout: {self.reverse_proxy_timeout}"
|
|
84
85
|
)
|
|
85
86
|
|
|
86
87
|
@cached_property
|
|
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
|
|
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
|
|
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
|