File: autoproxy.test

package info (click to toggle)
tcllib 1.19-dfsg-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 67,328 kB
  • sloc: tcl: 208,371; ansic: 14,215; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 583; makefile: 106; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (155 lines) | stat: -rw-r--r-- 4,678 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
source [file join \
            [file dirname [file dirname [file join [pwd] [info script]]]] \
            devtools testutilities.tcl]

testsNeedTcl  8.2
testsNeedTcltest 2.0

# uri and base64

testing {
    useLocal autoproxy.tcl autoproxy
}

# Clear the autoproxy package state for each test
proc packageReset {} {
    array set ::autoproxy::options {
        authProc "" basic "" no_proxy "" proxy_host "" proxy_port ""
    }
}

test autoproxy-1.0.0 "autoproxy::init standard" -setup {
    packageReset
} -body {
    autoproxy::init http://localhost:13128 "hosta,hostb"
    list [autoproxy::cget -host] \
        [autoproxy::cget -port] \
        [autoproxy::cget -no_proxy]
} -result {localhost 13128 {hosta hostb}}

test autoproxy-1.0.1 "autoproxy::init standard, auth" -setup {
    packageReset
} -body {
    autoproxy::init http://user:secret@localhost:13128 "hosta,hostb"
    list [autoproxy::cget -host] \
        [autoproxy::cget -port] \
        [autoproxy::cget -no_proxy] \
        [base64::decode [lindex [autoproxy::cget -basic] 1 1]]
} -result {localhost 13128 {hosta hostb} user:secret}

test autoproxy-1.0.2 "autoproxy::init standard, override" -setup {
    packageReset
} -body {
    autoproxy::init http://proxyone:13128 "hosta,hostb"
    autoproxy::init http://proxytwo:13129 "hostc,hostd"
    list [autoproxy::cget -host] \
        [autoproxy::cget -port] \
        [autoproxy::cget -no_proxy]
} -result {proxytwo 13129 {hostc hostd}}

test autoproxy-1.0.3 "autoproxy::init standard, auth, override" -setup {
    packageReset
} -body {
    autoproxy::init http://user:secret@localhost:13128 "hosta,hostb"
    autoproxy::init http://luser:passwd@proxy:13129 "hostc,hostd"
    list [autoproxy::cget -host] \
        [autoproxy::cget -port] \
        [autoproxy::cget -no_proxy] \
        [base64::decode [lindex [autoproxy::cget -basic] 1 1]]
} -result {proxy 13129 {hostc hostd} luser:passwd}

test autoproxy-1.0.4 "autoproxy::init standard, colons" -setup {
    packageReset
} -body {
    autoproxy::init http://localhost:13128 "hosta;hostb"
    list [autoproxy::cget -host] \
        [autoproxy::cget -port] \
        [autoproxy::cget -no_proxy]
} -result {localhost 13128 {hosta hostb}}

test autoproxy-1.1.0 "autoproxy::configure -host" -setup {
    packageReset
} -body {
    autoproxy::configure -host proxyhost
    autoproxy::cget -host
} -result {proxyhost}

test autoproxy-1.1.1 "autoproxy::configure -port" -setup {
    packageReset
} -body {
    autoproxy::configure -port 3128
    autoproxy::cget -port
} -result {3128}

test autoproxy-1.1.2 "autoproxy::configure -proxy_host" -setup {
    packageReset
} -body {
    autoproxy::configure -proxy_host proxyhost
    autoproxy::cget -proxy_host
} -result {proxyhost}

test autoproxy-1.1.3 "autoproxy::configure -proxy_port" -setup {
    packageReset
} -body {
    autoproxy::configure -proxy_port 3128
    autoproxy::cget -proxy_port
} -result {3128}

test autoproxy-1.1.4 "autoproxy::configure -no_proxy" -setup {
    packageReset
} -body {
    autoproxy::configure -no_proxy "localhost otherhost"
    autoproxy::cget -no_proxy
} -result {localhost otherhost}

test autoproxy-1.1.5 "autoproxy::configure -no_proxy override" -setup {
    packageReset
} -body {
    autoproxy::configure -no_proxy "localhost otherhost"
    autoproxy::configure -no_proxy "althost"
    autoproxy::cget -no_proxy
} -result {althost}

test autoproxy-1.1.6 "autoproxy::configure -authProc" -setup {
    packageReset
} -body {
    autoproxy::configure -authProc my_auth_proc
    autoproxy::cget -authProc
} -result {my_auth_proc}

test autoproxy-1.2.0 "autoproxy::configure -basic set details" -setup {
    packageReset
} -body {
    autoproxy::configure -basic -user test -password secret -realm tcllib
    autoproxy::cget -basic
} -result {Proxy-Authorization {Basic dGVzdDpzZWNyZXQ=}}

test autoproxy-1.2.1 "autoproxy::configure -basic confirm encoding" -setup {
    packageReset
} -body {
    autoproxy::configure -basic -user test -password secret -realm tcllib
    base64::decode [lindex [autoproxy::cget -basic] 1 1]
} -result {test:secret}

test autoproxy-1.2.2 "autoproxy::configure -basic reset" -setup {
    packageReset
    autoproxy::configure -basic -user test -password secret -realm tcllib
} -body {
    autoproxy::configure -basic --
    autoproxy::cget -basic
} -result {}

test autoproxy-1.2.3 "autoproxy::configure -basic reset (2)" -setup {
    packageReset
    autoproxy::configure -basic -user test -password secret -realm tcllib
} -body {
    autoproxy::configure -basic
    autoproxy::cget -basic
} -result {}

testsuiteCleanup

# Local variables:
#   mode: tcl
#   indent-tabs-mode: nil
# End: