trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackso...@apache.org
Subject [1/2] trafficserver git commit: add redirection test
Date Fri, 24 Apr 2015 03:23:51 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master fad02a76e -> 231f11e9a


add redirection test


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/609e1435
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/609e1435
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/609e1435

Branch: refs/heads/master
Commit: 609e143589d89b5be167914b70de99658776745f
Parents: fad02a7
Author: Feifei Cai <ffcai@yahoo-inc.com>
Authored: Fri Mar 27 07:38:52 2015 +0000
Committer: Thomas Jackson <jacksontj@apache.org>
Committed: Thu Apr 23 20:17:06 2015 -0700

----------------------------------------------------------------------
 ci/new_tsqa/tests/test_redirection.py | 46 ++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/609e1435/ci/new_tsqa/tests/test_redirection.py
----------------------------------------------------------------------
diff --git a/ci/new_tsqa/tests/test_redirection.py b/ci/new_tsqa/tests/test_redirection.py
new file mode 100644
index 0000000..99fed96
--- /dev/null
+++ b/ci/new_tsqa/tests/test_redirection.py
@@ -0,0 +1,46 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import requests
+import logging
+
+import helpers
+
+import tsqa.test_cases
+import tsqa.utils
+import tsqa.endpoint
+
+log = logging.getLogger(__name__)
+
+class TestRedirection(helpers.EnvironmentCase):
+    @classmethod
+    def setUpEnv(cls, env):
+        cls.configs['records.config']['CONFIG'].update({
+            'proxy.config.http.redirection_enabled': 1,
+            'proxy.config.http.number_of_redirections': 10
+        })
+        cls.configs['remap.config'].add_line('map / http://httpbin.org');
+
+    def test_redirection(self):
+        server_ports = self.configs['records.config']['CONFIG']['proxy.config.http.server_ports']
+
+        # By default Requests will perform location redirection
+        # Disable redirection handling with the allow_redirects parameter
+        r = requests.get('http://127.0.0.1:{0}/redirect/9'.format(server_ports), allow_redirects=False)
+        self.assertEqual(r.status_code, 200)
+
+        r = requests.get('http://127.0.0.1:{0}/redirect/10'.format(server_ports), allow_redirects=False)
+        self.assertEqual(r.status_code, 302)


Mime
View raw message