mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 10:43:13 +00:00
The Elastic Beanstalk nginx proxy kept its 1 MB default body limit, so every media upload over ~1 MB got an nginx 413 before reaching the API. Ship a .platform nginx override (120M) in the bundle and assert it in the bundle contract. Apply the client-confirmed contract: photos up to 10 MB (JPEG/PNG/HEIC), videos up to 100 MB (MP4/MOV), at most 10 photos and 3 videos per work order, with stable generic rejection messages. The request ceiling (110 MB) sits between the per-kind caps and the proxy so oversize files get the generic message. The vendor portal accepts the same photo/video types and caps.
70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Tests for check_app_terraform_isolation.isolation_violation."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from check_app_terraform_isolation import isolation_violation
|
|
|
|
|
|
class IsolationTests(unittest.TestCase):
|
|
def test_terraform_only(self) -> None:
|
|
self.assertIsNone(
|
|
isolation_violation(
|
|
[
|
|
"terraform/live/dev/main.tf",
|
|
"terraform/live/README.md",
|
|
]
|
|
)
|
|
)
|
|
|
|
def test_app_only(self) -> None:
|
|
self.assertIsNone(
|
|
isolation_violation(
|
|
[
|
|
"Api.SeaHavenIndustries/Controllers/WorkOrderController.cs",
|
|
".ebextensions/01_migrations.config",
|
|
"scripts/package-elastic-beanstalk.sh",
|
|
]
|
|
)
|
|
)
|
|
|
|
def test_docs_and_workflows_with_terraform(self) -> None:
|
|
self.assertIsNone(
|
|
isolation_violation(
|
|
[
|
|
"terraform/live/modules/environment-owned/main.tf",
|
|
".github/workflows/deploy.yaml",
|
|
"QUALITY_GATES.md",
|
|
"scripts/governance-check.sh",
|
|
]
|
|
)
|
|
)
|
|
|
|
def test_mixed_app_and_terraform_fails(self) -> None:
|
|
violation = isolation_violation(
|
|
[
|
|
"terraform/live/dev/main.tf",
|
|
"SeaHaven.Services/Implementation/WorkOrderService.cs",
|
|
]
|
|
)
|
|
self.assertIsNotNone(violation)
|
|
terraform_files, app_files = violation or ([], [])
|
|
self.assertEqual(terraform_files, ["terraform/live/dev/main.tf"])
|
|
self.assertTrue(any(path.endswith(".cs") for path in app_files))
|
|
|
|
def test_platform_proxy_config_is_app_side(self) -> None:
|
|
violation = isolation_violation(
|
|
[
|
|
"terraform/live/dev/main.tf",
|
|
".platform/nginx/conf.d/01_upload_body_size.conf",
|
|
]
|
|
)
|
|
self.assertIsNotNone(violation)
|
|
_, app_files = violation or ([], [])
|
|
self.assertEqual(app_files, [".platform/nginx/conf.d/01_upload_body_size.conf"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|