~ember/update-manager/ubuntu.bug1002956

« back to all changes in this revision

Viewing changes to tests/test_kernel_from_baseinstaller.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt, Michael Vogt, Brian Murray, Gabor Kelemen
  • Date: 2012-03-20 17:35:34 UTC
  • Revision ID: package-import@ubuntu.com-20120320173534-dtwdej5ltnbalyz2
Tags: 1:0.156.9
[ Michael Vogt ]
* DistUpgrade/DistUpgradeController.py:
  - support cdrom-only upgrades properly by using the backported
    libapt-{pkg,inst} and release-upgrader-python-apt from the CD
* DistUpgrade/DistUpgrade.cfg:
  - update KernelRemoval/Version to match oneirics kernel
* DistUpgrade/DistUpgrade.cfg.lucid:
  - update KernelRemoval/Version to match lucids kernel
* data/release-upgrades:
  - set releae upgrades default to "lts"

[ Brian Murray ]
* debian/source_update-manager.py: pass if attach_gsettings fails like on a
  server

[ Gabor Kelemen ]
* lp:~kelemeng/update-manager/bug957552:
  - Mark two accessible descriptions for translation. LP: #957552

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import os
 
4
import subprocess
 
5
import sys
 
6
import unittest
 
7
 
 
8
from mock import Mock,patch
 
9
 
 
10
sys.path.insert(0,"../")
 
11
from DistUpgrade.DistUpgradeCache import MyCache
 
12
from DistUpgrade.DistUpgradeConfigParser import DistUpgradeConfig
 
13
 
 
14
class TestKernelBaseinstaller(unittest.TestCase):
 
15
 
 
16
    def test_kernel_from_baseinstaller(self):
 
17
        # the upgrade expects this 
 
18
        os.chdir("../DistUpgrade")
 
19
        # get a config
 
20
        config = DistUpgradeConfig(".")
 
21
        config.set("Files", "LogDir", "/tmp")
 
22
        cache = MyCache(config, None, None, lock=False)
 
23
        cache._has_kernel_headers_installed = Mock()
 
24
        cache._has_kernel_headers_installed.return_value = True
 
25
        cache.getKernelsFromBaseInstaller = Mock()
 
26
        cache.getKernelsFromBaseInstaller.return_value = \
 
27
            ["linux-generic2-pae", "linux-generic2"]
 
28
        cache.mark_install = Mock()
 
29
        cache.mark_install.return_value = True
 
30
        cache._selectKernelFromBaseInstaller()
 
31
        #print cache.mark_install.call_args
 
32
        calls = cache.mark_install.call_args_list
 
33
        self.assertEqual(len(calls), 2)
 
34
        cache.mark_install.assert_any_call(
 
35
            "linux-generic2-pae", "Selecting new kernel from base-installer")
 
36
        cache.mark_install.assert_any_call(
 
37
            "linux-headers-generic2-pae", "Selecting new kernel headers from base-installer")
 
38
if __name__ == "__main__":
 
39
    import logging
 
40
    logging.basicConfig(level=logging.DEBUG)
 
41
    unittest.main()