threads / rfc / 20712

RFC patch, 3 partsgitweb: add test cases for snapshot settings

Subject: [RFC/PATCH 3/3] gitweb: add test cases for snapshot settings

## tl;dr

2 messages between Aug 23, 2009 and Aug 24, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Mark Rada· Aug 23, 2009, 21:53 UTC · lore

This commit adds a new test file (t9501) that is used for gitweb test cases that parse gitweb output to verify the HTTP status code or message.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
---
 t/t9501-gitweb-standalone-http-status.sh |   71 ++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100644 t/t9501-gitweb-standalone-http-status.sh
Show changes to t/t9501-gitweb-standalone-http-status.sh +71 −0
diff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh
new file mode 100644
index 0000000..c4b0479
--- /dev/null
+++ b/t/t9501-gitweb-standalone-http-status.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Mark Rada
+#
+
+. ./gitweb-lib.sh
+
+# ----------------------------------------------------------------------
+# snapshot settings
+
+test_commit \
+	'SnapshotTest' \
+	'i can has snapshot?'
+
+cat >>gitweb_config.perl <<\EOF
+$feature{'snapshot'}{'override'} = 0;
+EOF
+
+test_expect_success \
+    'snapshots: tgz only default format enabled' \
+    'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+    grep "Status: 200 OK" gitweb.output &&
+    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
+    grep "403 - Unsupported snapshot format" gitweb.output &&
+    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
+    grep "403 - Snapshot format not allowed" gitweb.output &&
+    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+    grep "403 - Unsupported snapshot format" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<\EOF
+$feature{'snapshot'}{'default'} = ['tgz','tbz2','txz','zip'];
+EOF
+
+test_expect_success \
+    'snapshots: all enabled in default, use default disabled value' \
+    'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+    grep "Status: 200 OK" gitweb.output &&
+    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
+    grep "Status: 200 OK" gitweb.output &&
+    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
+    grep "403 - Snapshot format not allowed" gitweb.output &&
+    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+    grep "Status: 200 OK" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<\EOF
+$known_snapshot_formats{'zip'}{'disabled'} = 1;
+EOF
+
+test_expect_success \
+    'snapshots: zip explicitly disabled' \
+    'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+    grep "403 - Snapshot format not allowed" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<\EOF
+$known_snapshot_formats{'tgz'}{'disabled'} = 0;
+EOF
+
+test_expect_success \
+    'snapshots: tgz explicitly enabled' \
+    'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+    grep "Status: 200 OK" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+test_done 
-- 
1.6.4
Jakub Narebski· Aug 24, 2009, 12:36 UTC · re: Mark Rada · lore

Re: [RFC/PATCH 3/3] gitweb: add test cases for snapshot settings

On Sun, 23 Aug 2009, Mark Rada wrote:
Show 6 quoted lines
> This commit adds a new test file (t9501) that is used for gitweb test
> cases that parse gitweb output to verify the HTTP status code or
> message.
> 
> Signed-off-by: Mark Rada <marada@uwaterloo.ca>
> ---

I would rather put emphasis on the fact that new test is created, which is meant to check that gitweb produces expected HTTP status codes.

-- >8 --
Subject: gitweb: Add t9501 test for gitweb's HTTP status codes

This commit adds a new test file (t9501), that is used for gitweb test cases that parse gitweb output to verify the HTTP status code or message.

Currently the only tests are about 'snapshot' feature settings -- [end cut] --

Or something like that.
-- 
Jakub Narebski
Poland

← back to recent threads