Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added more coverage of /json, leaving /json/login, /json/diff, and /json/user/save uncovered, and finding surprises with /json/wiki/diff, /json/timeline/ci, and /json/tag/cancel. All implemented coverage is of the best documented and easiest tested paths through each feature. Tests for edge cases and failure paths are not yet in place, nor are complete tests for full expected values in most cases. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | rberteig-json-test |
Files: | files | file ages | folders |
SHA1: |
c2c49b3543e9bd02a507a2e19d57dbc0 |
User & Date: | rberteig 2016-01-29 02:37:42.964 |
Context
2016-01-29
| ||
23:26 | Included the answer text supplied to a fossil command when provided to fossil_maybe_answer in a call to protOut. This makes debugging tests using fossil http and a GET or POST to /json easier. ... (check-in: f3401430 user: rberteig tags: rberteig-json-test) | |
02:37 | Added more coverage of /json, leaving /json/login, /json/diff, and /json/user/save uncovered, and finding surprises with /json/wiki/diff, /json/timeline/ci, and /json/tag/cancel. All implemented coverage is of the best documented and easiest tested paths through each feature. Tests for edge cases and failure paths are not yet in place, nor are complete tests for full expected values in most cases. ... (check-in: c2c49b35 user: rberteig tags: rberteig-json-test) | |
2016-01-28
| ||
20:21 | Added /json/whoami from CLI, changed /json/cap to only care that it worked from CLI since capabilities are sort of meaningless in CLI mode. Added checks for caps provided to each logged in user by /json/login from its own results. Starting on /json/branch/list. All tests pass except known bugs and TODOs. ... (check-in: bab84bd7 user: rberteig tags: rberteig-json-test) | |
Changes
Changes to test/json.test.
︙ | ︙ | |||
156 157 158 159 160 161 162 | # json artifact (file) fossil_json [concat artifact $UUID_empty] test_json_envelope_ok json-artifact-file-env test json-artifact-file {[dict get $JR payload type] eq "file"} test_json_payload json-artifact [concat type uuid size checkins] {} # json artifact (wiki) | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | # json artifact (file) fossil_json [concat artifact $UUID_empty] test_json_envelope_ok json-artifact-file-env test json-artifact-file {[dict get $JR payload type] eq "file"} test_json_payload json-artifact [concat type uuid size checkins] {} # json artifact (wiki) fossil wiki create Empty <<"-=BLANK=-" fossil_json wiki get Empty test json-wiki-get {[dict get $JR payload name] eq "Empty"} set uuid [dict get $JR payload uuid] fossil_json artifact $uuid test_json_envelope_ok json-artifact-wiki-env test json-artifact-wiki {[dict get $JR payload type] eq "wiki"} test_json_payload json-artifact-wiki [list type uuid artifact] {} |
︙ | ︙ | |||
232 233 234 235 236 237 238 | }] fossil_json --json-input anon-2 test_json_envelope_ok json-cap-env # No point checking any other flags, setup implies all, and all are # moot from CLI. test json-cap-CLI {[dict get $JR payload permissionFlags setup]} | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | }] fossil_json --json-input anon-2 test_json_envelope_ok json-cap-env # No point checking any other flags, setup implies all, and all are # moot from CLI. test json-cap-CLI {[dict get $JR payload permissionFlags setup]} test TODO-json-post-authentication false knownBug #TODO: implement support for POST with JSON payload from file #fossil_http_post_json /json anon-2 #test_json_envelope_ok json-cap-http-env #test json-cap-http {![dict get $JR payload permissionFlags setup]} # whoami # via CLI with no auth token supplied fossil_json whoami test_json_envelope_ok json-whoami-cli-env test_json_payload json-whoami-cli {name capabilities} {} test json-whoami-cli-name {[dict get $JR payload name] eq "nobody"} test_hascaps json-whoami-cli-cap "gjorz" [dict get $JR payload capabilities] #### BRANCHES # json branch list fossil_json branch list test_json_envelope_ok json-branch-list-env test_json_payload json-branch-list {range current branches} {} test json-branch-list-cur {[dict get $JR payload current] eq "trunk"} test json-branch-list-cnt {[llength [dict get $JR payload branches]] == 1} test json-branch-list-val {[dict get $JR payload branches] eq "trunk"} # json branch create fossil_json branch create alpha --basis trunk test_json_envelope_ok json-branch-create-env test_json_payload json-branch-create {name basis rid uuid isPrivate} {} #### CONFIG # json config get AREA # AREAs are skin ticket project all skin-backup foreach a [list skin ticket project all skin-backup] { fossil_json config get $a test_json_envelope_ok json-config-$a-env # payload depends on specific area and may be completely empty } #### DIFFS # json diff v1 v2 test TODO-json-diff false knownBug #### DIRECTORY LISTING # json dir DIRNAME fossil_json dir test_json_envelope_ok json-dir-env test_json_payload json-dir {name entries} {} #### FILE INFO # json finfo FILENAME fossil_json finfo empty test_json_envelope_ok json-finfo-env test_json_payload json-finfo {name checkins} {} #### QUERY # json query SQLCODE fossil_json query {"SELECT * FROM reportfmt"} test_json_envelope_ok json-query-env test_json_payload json-query {columns rows} {} #### STATS # json stat fossil_json stat test_json_envelope_ok json-stat-env test_json_payload json-stat {repositorySize ageDays ageYears projectCode compiler sqlite} \ {blobCount deltaCount uncompressedArtifactSize averageArtifactSize maxArtifactSize \ compressionRatio checkinCount fileCount wikiPageCount ticketCount} fossil_json stat -f test_json_envelope_ok json-stat-env test_json_payload json-stat {repositorySize \ blobCount deltaCount uncompressedArtifactSize averageArtifactSize maxArtifactSize \ compressionRatio checkinCount fileCount wikiPageCount ticketCount \ ageDays ageYears projectCode compiler sqlite} {} #### STATUS # NOTE: Local checkout required # json status fossil_json status test_json_envelope_ok json-status-env test_json_payload json-status {repository localRoot checkout files errorCount} {} #### TAGS # json tag add NAME CHECKIN VALUE fossil_json tag add blue trunk green test_json_envelope_ok json-tag-add-env test_json_payload json-tag-add {name value propagate raw appliedTo} {} # json tag cancel NAME CHECKIN fossil_json tag add cancel alpha test_json_envelope_ok json-tag-cancel-env # BUG? Doc says no payload. test_json_payload json-tag-cancel {name value propagate raw appliedTo} {} # json tag find NAME fossil_json tag find alpha test_json_envelope_ok json-tag-find-env test_json_payload json-tag-find {name raw type limit artifacts} {} test json-tag-find-count {[llength [dict get $JR payload artifacts]] >= 1} # json tag list CHECKIN fossil_json tag list test_json_envelope_ok json-tag-list-env test_json_payload json-tag-list {raw includeTickets tags} {} test json-tag-list-count {[llength [dict get $JR payload tags]] >= 2} #### TICKETS # API Docs say not yet defined, so it isn't quite fair to mark this # category as TODO for the test cases... # test TODO-json-tickets false knownBug #### TICKET REPORTS # json report get NUMBER fossil_json report get 1 test_json_envelope_ok json-report-get-env test_json_payload json-report-get {report owner title timestamp columns sqlCode} {} # json report list fossil_json report list test_json_envelope_ok json-report-list-env #test_json_payload json-report-list {raw includeTickets tags} {} test json-report-list-count {[llength [dict get $JR payload]] >= 1} # json report run NUMBER fossil_json report run 1 test_json_envelope_ok json-report-run-1-env test_json_payload json-report-list {report title sqlcode columnNames tickets} {} test json-report-list-count {[llength [dict get $JR payload columnNames]] >= 7} test json-report-list-count {[llength [dict get $JR payload tickets]] >= 0} #### TIMELINE # json timeline checkin fossil_json timeline checkin test_json_envelope_ok json-timeline-checkin-env test_json_payload json-timeline-checkin {limit timeline} {} set i 0 foreach t [dict get $JR payload timeline] { # parents appears only for entries that have a parent # files appears only if requested by the --files parameter test_dict_keys json-timeline-checkin-$i $t {type uuid timestamp comment user isLeaf tags} {} incr i } # json timeline ci fossil_json timeline ci test json-timeline-ci {[dict get $JR resultCode] ne "FOSSIL-1102"} knownBug #test_json_payload json-timeline-ci {limit timeline} {} # json timeline ticket fossil_json timeline ticket test_json_envelope_ok json-timeline-ticket-env test_json_payload json-timeline-ticket {limit timeline} {} # json timeline wiki fossil_json timeline wiki test_json_envelope_ok json-timeline-wiki-env test_json_payload json-timeline-wiki {limit timeline} {} #### USER MANAGEMENT # json user get foreach u [list nobody anonymous reader developer U1] { fossil_json user get $u test_json_envelope_ok json-user-get-$u-env test_json_payload json-user-get-$u {uid name capabilities info timestamp} {} } # json user list fossil_json user list test_json_envelope_ok json-user-list-env set i 0 foreach u [dict get $JR payload] { test_dict_keys json-user-list-$i $u {uid name capabilities info timestamp} {} incr i } # json user save test TODO-json-user-save false knownBug #### WIKI # wiki list fossil_json wiki list test_json_envelope_ok json-wiki-list-env set pages [dict get $JR payload] test json-wiki-1 {[llength $pages] == 1} |
︙ | ︙ |