~ubuntu-branches/ubuntu/intrepid/ubuntu-system-service/intrepid

« back to all changes in this revision

Viewing changes to test/test_verify_proxy

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-08-19 14:18:18 UTC
  • Revision ID: james.westby@ubuntu.com-20080819141818-6gs3fa82dxidv52p
Tags: 0.1.6
* debian/control:
  - add missing depends on policykit and python-dbus
* add socks support
* support no_proxy environment

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import sys
 
4
sys.path.insert(0, "../")
 
5
 
 
6
import unittest
 
7
 
 
8
from UbuntuSystemService.backend.utils import verify_proxy
 
9
 
 
10
class testVerifyProxy(unittest.TestCase):
 
11
 
 
12
    test_cases = { "http://hh-1h.bla.com:8080/test/test.jsp?d=dd&id=dki" : False,
 
13
                   "http://foo:3128" : True,
 
14
                   "http://foo:3128/" : True,
 
15
                   "http://foo.bar-z.com:3128/" : True,
 
16
                   "http://foo.bar.com/port-not-after-host:3" : False,
 
17
                   "http://foo:" : False,
 
18
                   "does-not-start-with-proto" : False,
 
19
                   "http://bad-host-chars?:3128/" : False,
 
20
                   "http://host:2182/invalid-chars-in-str\\" : False,
 
21
                   "http:no-forward-slashes:3128" :False,
 
22
                 }
 
23
 
 
24
    def testVerify(self):
 
25
        for (str, result) in self.test_cases.iteritems():
 
26
            self.assertEqual(verify_proxy("http", str), result,
 
27
                             "%s expected %s" % (str, result))
 
28
 
 
29
 
 
30
if __name__ == "__main__":
 
31
    unittest.main()
 
32
 
 
33