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
|
#!/usr/bin/python
import unittest
import os
import os.path
import sys
sys.path = [os.path.normpath(os.path.join(os.getcwd(),"../"))] + sys.path
import dbus
from UpdateManager.GtkProgress import GtkFetchProgress
from UpdateManager.UpdateManager import UpdateManager
from UpdateManager.MetaReleaseGObject import *
from UpdateManager.DistUpgradeFetcher import *
def _(s): return s
# FIXME: use dogtail
# something like (needs to run as a seperate process):
#
# from dogtail.procedural import *
# focus.application('displayconfig-gtk')
# focus.frame('Screen and Graphics Preferences')
# click("Plug 'n' Play", roleName='push button')
# focus.window('Choose Screen')
# select('Flat Panel 1024x768', roleName='table cell')
# keyCombo("Return")
# click('OK', roleName='push button')
class TestMetaReleaseGUI(unittest.TestCase):
def setUp(self):
self.new_dist = None
def new_dist_available(self, meta_release, upgradable_to):
#print "new dist: ", upgradable_to.name
#print "new dist: ", upgradable_to.version
#print "meta release: %s" % meta_release
self.new_dist = upgradable_to
def testnewdist(self):
meta = MetaRelease()
meta.METARELEASE_URI = "http://changelogs.ubuntu.com/meta-release-unit-testing"
meta._buildMetaReleaseFile()
meta.connect("new_dist_available", self.new_dist_available)
meta.download()
self.assert_(meta.downloading == False)
no_new_information = meta.check()
self.assert_(no_new_information == False)
self.assert_(self.new_dist is not None)
class TestReleaseUpgradeFetcherGUI(unittest.TestCase):
def _new_dist_available(self, meta_release, upgradable_to):
self.new_dist = upgradable_to
def setUp(self):
meta = MetaRelease()
meta.METARELEASE_URI = "http://changelogs.ubuntu.com/meta-release-unit-testing"
meta.connect("new_dist_available", self._new_dist_available)
meta.download()
self.assert_(meta.downloading == False)
no_new_information = meta.check()
self.assert_(no_new_information == False)
self.assert_(self.new_dist is not None)
def testdownloading(self):
parent = UpdateManager("/usr/share/update-manager/")
progress = GtkFetchProgress(parent,
_("Downloading the upgrade "
"tool"),
_("The upgrade tool will "
"guide you through the "
"upgrade process."))
fetcher = DistUpgradeFetcherGtk(self.new_dist, parent=parent, progress=progress)
self.assert_(fetcher.showReleaseNotes())
self.assert_(fetcher.fetchDistUpgrader())
self.assert_(fetcher.extractDistUpgrader())
fetcher.script = fetcher.tmpdir+"/gutsy"
#fetcher.verifyDistUprader()
self.assert_(fetcher.authenticate())
self.assert_(fetcher.runDistUpgrader())
if __name__ == '__main__':
unittest.main()
|