Fossil SCM

Add test case for issue with a read-only fossil repository causing confusing results for the JSON API over HTTP.

rberteig 2016-01-29 23:46 rberteig-json-test
Commit dc042c6a621ef0af6d5752cfc709f1f9a8b740db
1 file changed +29
--- test/json.test
+++ test/json.test
@@ -533,6 +533,35 @@
533533
set codes [dict get $JR payload]
534534
test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
535535
# foreach c $codes {
536536
# puts [dict values $c]
537537
# }
538
+
539
+
540
+##### From the API Docs
541
+# Reminder to self: in March 2012 i saw a corner-case which returns
542
+# HTML output. To reproduce: chmod 444 REPO, then submit a request
543
+# which writes something (timeline creates a temp table). The "repo
544
+# is not writable" error comes back as HTML. i don't know if the
545
+# error happens before we have made the determination that the app is
546
+# in JSON mode or if the error handling is incorrectly not
547
+# recognizing JSON mode.
548
+#
549
+#repo_init x.fossil
550
+#catch {exec chmod 444 .rep.fossil}; # Unix. What about Win?
551
+fossil_http_json /json/timeline/checkin $U1Cookie
552
+test json-ROrepo-1-1 {$CODE == 0}
553
+test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]}
554
+test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
555
+test_json_envelope_ok json-http-timeline1
556
+protOut "chmod 444 repo"
557
+catch {exec chmod 444 .rep.fossil}; # Unix. What about Win?
558
+fossil_http_json /json/timeline/checkin $U1Cookie -expectError
559
+test json-ROrepo-2-1 {$CODE != 0}
560
+test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} knownBug
561
+test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} knownBug
562
+#test_json_envelope_ok json-http-timeline2
563
+
564
+
565
+catch {exec chmod 666 .rep.fossil}; # Unix. What about Win?
566
+
538567
539568
--- test/json.test
+++ test/json.test
@@ -533,6 +533,35 @@
533 set codes [dict get $JR payload]
534 test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
535 # foreach c $codes {
536 # puts [dict values $c]
537 # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
539
--- test/json.test
+++ test/json.test
@@ -533,6 +533,35 @@
533 set codes [dict get $JR payload]
534 test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
535 # foreach c $codes {
536 # puts [dict values $c]
537 # }
538
539
540 ##### From the API Docs
541 # Reminder to self: in March 2012 i saw a corner-case which returns
542 # HTML output. To reproduce: chmod 444 REPO, then submit a request
543 # which writes something (timeline creates a temp table). The "repo
544 # is not writable" error comes back as HTML. i don't know if the
545 # error happens before we have made the determination that the app is
546 # in JSON mode or if the error handling is incorrectly not
547 # recognizing JSON mode.
548 #
549 #repo_init x.fossil
550 #catch {exec chmod 444 .rep.fossil}; # Unix. What about Win?
551 fossil_http_json /json/timeline/checkin $U1Cookie
552 test json-ROrepo-1-1 {$CODE == 0}
553 test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]}
554 test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
555 test_json_envelope_ok json-http-timeline1
556 protOut "chmod 444 repo"
557 catch {exec chmod 444 .rep.fossil}; # Unix. What about Win?
558 fossil_http_json /json/timeline/checkin $U1Cookie -expectError
559 test json-ROrepo-2-1 {$CODE != 0}
560 test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} knownBug
561 test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} knownBug
562 #test_json_envelope_ok json-http-timeline2
563
564
565 catch {exec chmod 666 .rep.fossil}; # Unix. What about Win?
566
567
568

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button