Fossil

Check-in [dc042c6a]
Login

Check-in [dc042c6a]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add test case for issue with a read-only fossil repository causing confusing results for the JSON API over HTTP.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rberteig-json-test
Files: files | file ages | folders
SHA1: dc042c6a621ef0af6d5752cfc709f1f9a8b740db
User & Date: rberteig 2016-01-29 23:46:55.931
Context
2016-01-30
00:43
Added test case for /json/diff/UUID_V1/UUID_V2. Note that this case passes and clearly does diff the versions in the expected order. ... (check-in: f28e7713 user: rberteig tags: rberteig-json-test)
2016-01-29
23:46
Add test case for issue with a read-only fossil repository causing confusing results for the JSON API over HTTP. ... (check-in: dc042c6a user: rberteig tags: rberteig-json-test)
23:40
Add cookie support to fossil_http_json, as well as extra args passed through to fossil_maybe_answer so -expectError can be used. Tweak some comments. Note doc revision eliminating /json/timeline/ci, which clears a previous knownBug. Cache a usable login cookie for both anonymous and user U1 for later use. ... (check-in: a9edb60a user: rberteig tags: rberteig-json-test)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/json.test.
531
532
533
534
535
536
537





























538
fossil_json resultCodes
test_json_envelope_ok json-resultCodes-env
set codes [dict get $JR payload]
test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
# foreach c $codes {
#   puts [dict values $c]
# }





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
fossil_json resultCodes
test_json_envelope_ok json-resultCodes-env
set codes [dict get $JR payload]
test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
# foreach c $codes {
#   puts [dict values $c]
# }


##### From the API Docs
# Reminder to self: in March 2012 i saw a corner-case which returns
# HTML output. To reproduce: chmod 444 REPO, then submit a request
# which writes something (timeline creates a temp table). The "repo
# is not writable" error comes back as HTML. i don't know if the
# error happens before we have made the determination that the app is
# in JSON mode or if the error handling is incorrectly not
# recognizing JSON mode. 
#
#repo_init x.fossil
#catch {exec chmod 444 .rep.fossil}; # Unix. What about Win?
fossil_http_json /json/timeline/checkin $U1Cookie
test json-ROrepo-1-1 {$CODE == 0}
test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]}
test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
test_json_envelope_ok json-http-timeline1
protOut "chmod 444 repo"
catch {exec chmod 444 .rep.fossil}; # Unix. What about Win?
fossil_http_json /json/timeline/checkin $U1Cookie -expectError
test json-ROrepo-2-1 {$CODE != 0}
test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} knownBug
test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} knownBug
#test_json_envelope_ok json-http-timeline2


catch {exec chmod 666 .rep.fossil}; # Unix. What about Win?