diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2018-11-12 09:48:17 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2018-11-12 09:48:17 (GMT) |
commit | fa2ceeffffa5a2d4e4de3648f253bedc3d95e22d (patch) | |
tree | 61df1e77507e9efc5b386dae6710ec5557acb9a1 /tests/httpcookie.test | |
parent | bd29989aabaeadc5fb048cdf88c0448bbf658c57 (diff) | |
download | tcl-fa2ceeffffa5a2d4e4de3648f253bedc3d95e22d.zip tcl-fa2ceeffffa5a2d4e4de3648f253bedc3d95e22d.tar.gz tcl-fa2ceeffffa5a2d4e4de3648f253bedc3d95e22d.tar.bz2 |
Make cookiejar tests skip gracefully
Diffstat (limited to 'tests/httpcookie.test')
-rw-r--r-- | tests/httpcookie.test | 127 |
1 files changed, 66 insertions, 61 deletions
diff --git a/tests/httpcookie.test b/tests/httpcookie.test index 0facb6a..d4acad9 100644 --- a/tests/httpcookie.test +++ b/tests/httpcookie.test @@ -12,39 +12,44 @@ package require tcltest 2 namespace import -force ::tcltest::* +testConstraint sqlite3 [expr {![catch { + package require sqlite3 +}]}] testConstraint cookiejar [expr {![catch { - package require cookiejar + if {[testConstraint sqlite3]} { + package require cookiejar + } }]}] -test http-cookiejar-1.1 {cookie storage: packaging} cookiejar { +test http-cookiejar-1.1 {cookie storage: packaging} {sqlite3 cookiejar} { package require cookiejar } 0.1 -test http-cookiejar-1.2 {cookie storage: packaging} cookiejar { +test http-cookiejar-1.2 {cookie storage: packaging} {sqlite3 cookiejar} { package require cookiejar package require cookiejar } 0.1 -test http-cookiejar-2.1 {cookie storage: basics} -constraints cookiejar -body { +test http-cookiejar-2.1 {cookie storage: basics} -constraints {sqlite3 cookiejar} -body { http::cookiejar } -returnCodes error -result {wrong # args: should be "http::cookiejar method ?arg ...?"} -test http-cookiejar-2.2 {cookie storage: basics} -constraints cookiejar -body { +test http-cookiejar-2.2 {cookie storage: basics} -constraints {sqlite3 cookiejar} -body { http::cookiejar ? } -returnCodes error -result {unknown method "?": must be configure, create, destroy or new} -test http-cookiejar-2.3 {cookie storage: basics} cookiejar { +test http-cookiejar-2.3 {cookie storage: basics} {sqlite3 cookiejar} { http::cookiejar configure } {-domainfile -domainlist -domainrefresh -loglevel -offline -purgeold -retain -vacuumtrigger} -test http-cookiejar-2.4 {cookie storage: basics} -constraints cookiejar -body { +test http-cookiejar-2.4 {cookie storage: basics} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure a b c d e } -returnCodes error -result {wrong # args: should be "http::cookiejar configure ?optionName? ?optionValue?"} -test http-cookiejar-2.5 {cookie storage: basics} -constraints cookiejar -body { +test http-cookiejar-2.5 {cookie storage: basics} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure a } -returnCodes error -result {bad option "a": must be -domainfile, -domainlist, -domainrefresh, -loglevel, -offline, -purgeold, -retain, or -vacuumtrigger} -test http-cookiejar-2.6 {cookie storage: basics} -constraints cookiejar -body { +test http-cookiejar-2.6 {cookie storage: basics} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -d } -returnCodes error -result {ambiguous option "-d": must be -domainfile, -domainlist, -domainrefresh, -loglevel, -offline, -purgeold, -retain, or -vacuumtrigger} test http-cookiejar-2.7 {cookie storage: basics} -setup { set old [http::cookiejar configure -loglevel] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { list [http::cookiejar configure -loglevel] \ [http::cookiejar configure -loglevel debug] \ [http::cookiejar configure -loglevel] \ @@ -55,7 +60,7 @@ test http-cookiejar-2.7 {cookie storage: basics} -setup { } -result {info debug debug error error} test http-cookiejar-2.8 {cookie storage: basics} -setup { set old [http::cookiejar configure -loglevel] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { list [http::cookiejar configure -loglevel] \ [http::cookiejar configure -loglevel d] \ [http::cookiejar configure -loglevel i] \ @@ -64,40 +69,40 @@ test http-cookiejar-2.8 {cookie storage: basics} -setup { } -cleanup { http::cookiejar configure -loglevel $old } -result {info debug info warn error} -test http-cookiejar-2.9 {cookie storage: basics} -constraints cookiejar -body { +test http-cookiejar-2.9 {cookie storage: basics} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -off } -match glob -result * test http-cookiejar-2.10 {cookie storage: basics} -setup { set oldval [http::cookiejar configure -offline] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -offline true } -cleanup { catch {http::cookiejar configure -offline $oldval} } -result 1 test http-cookiejar-2.11 {cookie storage: basics} -setup { set oldval [http::cookiejar configure -offline] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -offline nonbool } -cleanup { catch {http::cookiejar configure -offline $oldval} } -returnCodes error -result {expected boolean value but got "nonbool"} test http-cookiejar-2.12 {cookie storage: basics} -setup { set oldval [http::cookiejar configure -purgeold] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -purge nonint } -cleanup { catch {http::cookiejar configure -purgeold $oldval} } -returnCodes error -result {expected positive integer but got "nonint"} test http-cookiejar-2.13 {cookie storage: basics} -setup { set oldval [http::cookiejar configure -domainrefresh] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -domainref nonint } -cleanup { catch {http::cookiejar configure -domainrefresh $oldval} } -returnCodes error -result {expected positive integer but got "nonint"} test http-cookiejar-2.14 {cookie storage: basics} -setup { set oldval [http::cookiejar configure -domainrefresh] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -domainref -42 } -cleanup { catch {http::cookiejar configure -domainrefresh $oldval} @@ -106,7 +111,7 @@ test http-cookiejar-2.15 {cookie storage: basics} -setup { set oldval [http::cookiejar configure -domainrefresh] set result unset set tracer [http::cookiejar create tracer] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { oo::objdefine $tracer method PostponeRefresh {} { set ::result set next @@ -118,28 +123,28 @@ test http-cookiejar-2.15 {cookie storage: basics} -setup { catch {http::cookiejar configure -domainrefresh $oldval} } -result set -test http-cookiejar-3.1 {cookie storage: class} cookiejar { +test http-cookiejar-3.1 {cookie storage: class} {sqlite3 cookiejar} { info object isa object http::cookiejar } 1 -test http-cookiejar-3.2 {cookie storage: class} cookiejar { +test http-cookiejar-3.2 {cookie storage: class} {sqlite3 cookiejar} { info object isa class http::cookiejar } 1 -test http-cookiejar-3.3 {cookie storage: class} cookiejar { +test http-cookiejar-3.3 {cookie storage: class} {sqlite3 cookiejar} { lsort [info object methods http::cookiejar] } {configure} -test http-cookiejar-3.4 {cookie storage: class} cookiejar { +test http-cookiejar-3.4 {cookie storage: class} {sqlite3 cookiejar} { lsort [info object methods http::cookiejar -all] } {configure create destroy new} test http-cookiejar-3.5 {cookie storage: class} -setup { catch {rename ::cookiejar ""} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { namespace eval :: {http::cookiejar create cookiejar} } -cleanup { catch {rename ::cookiejar ""} } -result ::cookiejar test http-cookiejar-3.6 {cookie storage: class} -setup { catch {rename ::cookiejar ""} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { list [http::cookiejar create ::cookiejar] [info commands ::cookiejar] \ [::cookiejar destroy] [info commands ::cookiejar] } -cleanup { @@ -147,7 +152,7 @@ test http-cookiejar-3.6 {cookie storage: class} -setup { } -result {::cookiejar ::cookiejar {} {}} test http-cookiejar-3.7 {cookie storage: class} -setup { catch {rename ::cookiejar ""} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar create ::cookiejar foo bar } -returnCodes error -cleanup { catch {rename ::cookiejar ""} @@ -156,7 +161,7 @@ test http-cookiejar-3.8 {cookie storage: class} -setup { catch {rename ::cookiejar ""} set f [makeFile "" cookiejar] file delete $f -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar create ::cookiejar $f } -cleanup { catch {rename ::cookiejar ""} @@ -165,7 +170,7 @@ test http-cookiejar-3.8 {cookie storage: class} -setup { test http-cookiejar-3.9 {cookie storage: class} -setup { catch {rename ::cookiejar ""} set f [makeFile "bogus content for a database" cookiejar] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar create ::cookiejar $f } -returnCodes error -cleanup { catch {rename ::cookiejar ""} @@ -174,7 +179,7 @@ test http-cookiejar-3.9 {cookie storage: class} -setup { test http-cookiejar-3.10 {cookie storage: class} -setup { catch {rename ::cookiejar ""} set dir [makeDirectory cookiejar] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar create ::cookiejar $dir } -returnCodes error -cleanup { catch {rename ::cookiejar ""} @@ -183,49 +188,49 @@ test http-cookiejar-3.10 {cookie storage: class} -setup { test http-cookiejar-4.1 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar } -returnCodes error -cleanup { ::cookiejar destroy } -result {wrong # args: should be "cookiejar method ?arg ...?"} test http-cookiejar-4.2 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar ? } -returnCodes error -cleanup { ::cookiejar destroy } -result {unknown method "?": must be destroy, forceLoadDomainData, getCookies, lookup, policyAllow or storeCookie} test http-cookiejar-4.3 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { lsort [info object methods cookiejar -all] } -cleanup { ::cookiejar destroy } -result {destroy forceLoadDomainData getCookies lookup policyAllow storeCookie} test http-cookiejar-4.4 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar getCookies } -returnCodes error -cleanup { ::cookiejar destroy } -result {wrong # args: should be "cookiejar getCookies proto host path"} test http-cookiejar-4.5 {cookie storage} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar getCookies http www.example.com / } -cleanup { ::cookiejar destroy } -result {} test http-cookiejar-4.6 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie } -returnCodes error -cleanup { ::cookiejar destroy } -result {wrong # args: should be "cookiejar storeCookie options"} test http-cookiejar-4.7 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar @@ -241,7 +246,7 @@ test http-cookiejar-4.7 {cookie storage: instance} -setup { test http-cookiejar-4.8 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar oo::objdefine ::cookiejar export Database -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar @@ -259,7 +264,7 @@ test http-cookiejar-4.8 {cookie storage: instance} -setup { test http-cookiejar-4.9 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar oo::objdefine ::cookiejar export Database -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar @@ -276,7 +281,7 @@ test http-cookiejar-4.9 {cookie storage: instance} -setup { } -result 0 test http-cookiejar-4.10 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie [dict replace { key foo value bar @@ -292,7 +297,7 @@ test http-cookiejar-4.10 {cookie storage: instance} -setup { test http-cookiejar-4.11 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar oo::objdefine ::cookiejar export Database -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie [dict replace { key foo value bar @@ -310,7 +315,7 @@ test http-cookiejar-4.11 {cookie storage: instance} -setup { test http-cookiejar-4.12 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar oo::objdefine ::cookiejar export Database -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie [dict replace { key foo value bar @@ -328,7 +333,7 @@ test http-cookiejar-4.12 {cookie storage: instance} -setup { test http-cookiejar-4.13 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { lappend result [cookiejar getCookies http www.example.com /] cookiejar storeCookie { key foo @@ -346,7 +351,7 @@ test http-cookiejar-4.13 {cookie storage: instance} -setup { test http-cookiejar-4.14 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { lappend result [cookiejar getCookies http www.example.com /] cookiejar storeCookie [dict replace { key foo @@ -364,7 +369,7 @@ test http-cookiejar-4.14 {cookie storage: instance} -setup { test http-cookiejar-4.15 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { lappend result [cookiejar getCookies http www.example.com /] cookiejar storeCookie { key foo @@ -391,7 +396,7 @@ test http-cookiejar-4.15 {cookie storage: instance} -setup { test http-cookiejar-4.16 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { lappend result [cookiejar getCookies http www.example.com /] cookiejar storeCookie { key foo1 @@ -417,7 +422,7 @@ test http-cookiejar-4.16 {cookie storage: instance} -setup { } -result {{} {foo1 bar foo2 bar}} test http-cookiejar-4.17 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar lookup a b c d } -returnCodes error -cleanup { ::cookiejar destroy @@ -425,7 +430,7 @@ test http-cookiejar-4.17 {cookie storage: instance} -setup { test http-cookiejar-4.18 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { lappend result [cookiejar lookup] lappend result [cookiejar lookup www.example.com] lappend result [catch {cookiejar lookup www.example.com foo} value] $value @@ -447,7 +452,7 @@ test http-cookiejar-4.18 {cookie storage: instance} -setup { test http-cookiejar-4.19 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar @@ -477,7 +482,7 @@ test http-cookiejar-4.19 {cookie storage: instance} -setup { test http-cookiejar-4.20 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo1 value bar1 @@ -506,7 +511,7 @@ test http-cookiejar-4.20 {cookie storage: instance} -setup { test http-cookiejar-4.21 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo1 value bar1 @@ -535,7 +540,7 @@ test http-cookiejar-4.21 {cookie storage: instance} -setup { test http-cookiejar-4.22 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar forceLoadDomainData x y z } -returnCodes error -cleanup { ::cookiejar destroy @@ -543,14 +548,14 @@ test http-cookiejar-4.22 {cookie storage: instance} -setup { test http-cookiejar-4.23 {cookie storage: instance} -setup { http::cookiejar create ::cookiejar set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar forceLoadDomainData } -cleanup { ::cookiejar destroy } -result {} test http-cookiejar-4.23.a {cookie storage: instance} -setup { set off [http::cookiejar configure -offline] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -offline 1 [http::cookiejar create ::cookiejar] destroy } -cleanup { @@ -559,7 +564,7 @@ test http-cookiejar-4.23.a {cookie storage: instance} -setup { } -result {} test http-cookiejar-4.23.b {cookie storage: instance} -setup { set off [http::cookiejar configure -offline] -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar configure -offline 0 [http::cookiejar create ::cookiejar] destroy } -cleanup { @@ -570,7 +575,7 @@ test http-cookiejar-4.23.b {cookie storage: instance} -setup { test http-cookiejar-5.1 {cookie storage: constraints} -setup { http::cookiejar create ::cookiejar cookiejar forceLoadDomainData -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar @@ -587,7 +592,7 @@ test http-cookiejar-5.1 {cookie storage: constraints} -setup { test http-cookiejar-5.2 {cookie storage: constraints} -setup { http::cookiejar create ::cookiejar cookiejar forceLoadDomainData -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar @@ -604,7 +609,7 @@ test http-cookiejar-5.2 {cookie storage: constraints} -setup { test http-cookiejar-5.3 {cookie storage: constraints} -setup { http::cookiejar create ::cookiejar cookiejar forceLoadDomainData -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo1 value bar @@ -630,7 +635,7 @@ test http-cookiejar-5.3 {cookie storage: constraints} -setup { test http-cookiejar-5.4 {cookie storage: constraints} -setup { http::cookiejar create ::cookiejar cookiejar forceLoadDomainData -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo value bar1 @@ -656,7 +661,7 @@ test http-cookiejar-5.4 {cookie storage: constraints} -setup { test http-cookiejar-5.5 {cookie storage: constraints} -setup { http::cookiejar create ::cookiejar cookiejar forceLoadDomainData -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { cookiejar storeCookie { key foo1 value 1 @@ -754,7 +759,7 @@ test http-cookiejar-6.1 {cookie storage: expiry and lookup} -setup { global result lappend result [lsort [lmap {k v} $cookies {set v}]] } -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { values [cookiejar getCookies http www.example.com /] cookiejar storeCookie { key foo @@ -810,7 +815,7 @@ test http-cookiejar-7.1 {cookie storage: persistence of persistent cookies} -set catch {rename ::cookiejar ""} set f [makeFile "" cookiejar] file delete $f -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar create ::cookiejar $f ::cookiejar destroy http::cookiejar create ::cookiejar $f @@ -823,7 +828,7 @@ test http-cookiejar-7.2 {cookie storage: persistence of persistent cookies} -set set f [makeFile "" cookiejar] file delete $f set result {} -} -constraints cookiejar -body { +} -constraints {sqlite3 cookiejar} -body { http::cookiejar create ::cookiejar $f cookiejar storeCookie [dict replace { key foo |