~ubuntu-branches/ubuntu/maverick/update-manager/maverick-updates

« back to all changes in this revision

Viewing changes to tests/test_proxy.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Michael Vogt, Brian Murray
  • Date: 2010-06-09 14:32:05 UTC
  • Revision ID: james.westby@ubuntu.com-20100609143205-ov7osgcx3qlwz5hd
Tags: 1:0.142
[ Michael Vogt ]
* check-new-release-gtk: 
  - fix "ask me later" button time
* DistUpgrade/DistUpgradeController.py,
  DistUpgrade/DistUpgradeCache.py,
  UpdateManager/Core/MetaRelease.py,
  UpdateManager/Core/utils.py,
  UpdateManager/Core/MyCache.py,
  UpdateManager/Core/UpdateList.py,
  UpdateManager/GtkProgress.py,
  UpdateManager/UpdateManager.py:
  - update for python-apt 0.8 API, add tests (LP: #591236)
* check-new-release-gtk:
  - remove no longer needed warnings filter

[ Brian Murray ]
* string fix for 'is aborted now' to 'has aborted'
* fix in debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import unittest
 
4
 
 
5
import apt_pkg
 
6
import logging
 
7
import os
 
8
import os.path
 
9
import sys
 
10
import time
 
11
 
 
12
sys.path.insert(0, "../")
 
13
from UpdateManager.Core.utils import init_proxy
 
14
 
 
15
class TestInitProxy(unittest.TestCase):
 
16
 
 
17
    def testinitproxy(self):
 
18
        import gconf
 
19
        proxy = "http://10.0.2.2:3128"
 
20
        try:
 
21
            del os.environ["http_proxy"]
 
22
        except KeyError: 
 
23
            pass
 
24
        apt_pkg.Config.set("Acquire::http::proxy", proxy)
 
25
        client = gconf.client_get_default()
 
26
        detected_proxy = init_proxy(client)
 
27
        self.assertEqual(detected_proxy, proxy)
 
28
 
 
29
if __name__ == '__main__':
 
30
    if len(sys.argv) > 1 and sys.argv[1] == "-v":
 
31
        logging.basicConfig(level=logging.DEBUG)
 
32
    unittest.main()