浏览代码

Plone add tests for CORS_ env

Alin Voinea 6 年之前
父节点
当前提交
fb6eac6645
共有 3 个文件被更改,包括 27 次插入0 次删除
  1. 1 0
      test/config.sh
  2. 14 0
      test/tests/plone-cors/expected-std-out.txt
  3. 12 0
      test/tests/plone-cors/run.sh

+ 1 - 0
test/config.sh

@@ -179,6 +179,7 @@ imageTests+=(
 	[plone]='
 		plone-basics
 		plone-addons
+		plone-cors
 		plone-versions
 		plone-zeoclient
 	'

+ 14 - 0
test/tests/plone-cors/expected-std-out.txt

@@ -0,0 +1,14 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+  <configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:plone="http://namespaces.plone.org/plone">
+    <plone:CORSPolicy
+      allow_origin="http://example.com:4300"
+      allow_methods="DELETE,PUT"
+      allow_credentials="false"
+      expose_headers="X-Example-Header"
+      allow_headers="X-Example-Header,X-Z-Header"
+      max_age="600"
+     />
+  </configure>
+</configure>

+ 12 - 0
test/tests/plone-cors/run.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+set -eo pipefail
+
+docker run -i --rm \
+	-e CORS_ALLOW_ORIGIN="http://example.com:4300,http://example.com:5300" \
+	-e CORS_ALLOW_METHODS="DELETE,PUT" \
+	-e CORS_ALLOW_CREDENTIALS=false \
+	-e CORS_EXPOSE_HEADERS="X-Example-Header" \
+	-e CORS_ALLOW_HEADERS="X-Example-Header,X-Z-Header" \
+	-e CORS_MAX_AGE=600 \
+	-v /plone/instance/bin/develop \
+	"$1" cat parts/instance/etc/package-includes/999-additional-overrides.zcml