{"thread":{"id":"20729","subject":"[PATCH v2 3/3] gitweb: add t9501 tests for checking HTTP status codes","startedAt":"2009-08-25T05:03:48Z","lastAt":"2009-08-25T05:03:48Z","messageCount":1,"participants":["Mark Rada"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"121708","messageId":"4A9370B4.9000009@mailservices.uwaterloo.ca","threadId":"20729","inReplyTo":null,"subject":"[PATCH v2 3/3] gitweb: add t9501 tests for checking HTTP status codes","fromName":"Mark Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2009-08-25T05:03:48Z","receivedAt":"2009-08-25T05:03:48Z","isPatch":true,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"Commit message changed as suggested by Jakub.\n\nAlso added a test_description, and removed a bit of whitespace\nthat I hadn't noticed before.\n\n-- \nMark A Rada (ferrous26)\nmarada@uwaterloo.ca\n\n\n--->8---\nThis commit adds a new test file, t9501, that is used for gitweb\ntest cases that check HTTP status codes and messages.\n\nCurrently, the only tests are for the snapshot feature.\n\nSigned-off-by: Mark Rada <marada@uwaterloo.ca>\n---\n t/t9501-gitweb-standalone-http-status.sh |   78 ++++++++++++++++++++++++++++++\n 1 files changed, 78 insertions(+), 0 deletions(-)\n create mode 100644 t/t9501-gitweb-standalone-http-status.sh\n\ndiff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh\nnew file mode 100644\nindex 0000000..d0ff21d\n--- /dev/null\n+++ b/t/t9501-gitweb-standalone-http-status.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2009 Mark Rada\n+#\n+\n+test_description='gitweb as standalone script (http status tests).\n+\n+This test runs gitweb (git web interface) as a CGI script from the\n+commandline, and checks that it returns the expected HTTP status\n+code and message.'\n+\n+\n+. ./gitweb-lib.sh\n+\n+# ----------------------------------------------------------------------\n+# snapshot settings\n+\n+test_commit \\\n+\t'SnapshotTests' \\\n+\t'i can has snapshot?'\n+\n+cat >>gitweb_config.perl <<\\EOF\n+$feature{'snapshot'}{'override'} = 0;\n+EOF\n+\n+test_expect_success \\\n+    'snapshots: tgz only default format enabled' \\\n+    'gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tgz\" &&\n+    grep \"Status: 200 OK\" gitweb.output &&\n+    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tbz2\" &&\n+    grep \"403 - Unsupported snapshot format\" gitweb.output &&\n+    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=txz\" &&\n+    grep \"403 - Snapshot format not allowed\" gitweb.output &&\n+    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=zip\" &&\n+    grep \"403 - Unsupported snapshot format\" gitweb.output'\n+test_debug 'cat gitweb.output'\n+\n+\n+cat >>gitweb_config.perl <<\\EOF\n+$feature{'snapshot'}{'default'} = ['tgz','tbz2','txz','zip'];\n+EOF\n+\n+test_expect_success \\\n+    'snapshots: all enabled in default, use default disabled value' \\\n+    'gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tgz\" &&\n+    grep \"Status: 200 OK\" gitweb.output &&\n+    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tbz2\" &&\n+    grep \"Status: 200 OK\" gitweb.output &&\n+    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=txz\" &&\n+    grep \"403 - Snapshot format not allowed\" gitweb.output &&\n+    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=zip\" &&\n+    grep \"Status: 200 OK\" gitweb.output'\n+test_debug 'cat gitweb.output'\n+\n+\n+cat >>gitweb_config.perl <<\\EOF\n+$known_snapshot_formats{'zip'}{'disabled'} = 1;\n+EOF\n+\n+test_expect_success \\\n+    'snapshots: zip explicitly disabled' \\\n+    'gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=zip\" &&\n+    grep \"403 - Snapshot format not allowed\" gitweb.output'\n+test_debug 'cat gitweb.output'\n+\n+\n+cat >>gitweb_config.perl <<\\EOF\n+$known_snapshot_formats{'tgz'}{'disabled'} = 0;\n+EOF\n+\n+test_expect_success \\\n+    'snapshots: tgz explicitly enabled' \\\n+    'gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tgz\" &&\n+    grep \"Status: 200 OK\" gitweb.output'\n+test_debug 'cat gitweb.output'\n+\n+\n+test_done\n-- \n1.6.4\n"}]}