~mvo/unattended-upgrades/timed-reboot

« back to all changes in this revision

Viewing changes to test/test_conffile.py

  • Committer: Michael Vogt
  • Date: 2012-06-29 07:08:35 UTC
  • mfrom: (228.1.5 debian-wheezy)
  • Revision ID: michael.vogt@ubuntu.com-20120629070835-uglivm8h92ex35hg
merged from the debian-wheezy branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
from unattended_upgrade import conffile_prompt
9
9
 
10
 
class TestConffilePrompt(unittest.TestCase):
 
10
class ConffilePromptTestCase(unittest.TestCase):
 
11
 
11
12
    def setUp(self):
12
13
        apt_pkg.config.set("Dir::State::status",
13
14
                           "./root.conffile/var/lib/dpkg/status")
14
15
 
15
 
    def testWillPrompt(self):
 
16
    def test_will_prompt(self):
16
17
        # conf-test 0.9 is installed, 1.1 gets installed
17
18
        # they both have different config files
18
19
        test_pkg = "./packages/conf-test-package_1.1.deb"
19
20
        self.assertTrue(conffile_prompt(test_pkg, prefix="./root.conffile"),
20
21
                        "conffile prompt detection incorrect")
21
22
    
22
 
    def testWillNotPrompt(self):
 
23
    def test_will_not_prompt(self):
23
24
        # conf-test 0.9 is installed, 1.0 gets installed
24
25
        # they both have the same config files
25
26
        test_pkg = "./packages/conf-test-package_1.0.deb"
26
27
        self.assertFalse(conffile_prompt(test_pkg, prefix="./root.conffile"),
27
28
                        "conffile prompt detection incorrect")
28
29
 
29
 
    def testWillNotPrompt(self):
 
30
    def test_with_many_entries(self):
30
31
        # ensure we don't crash when encountering a conffile with overly
31
32
        # many entries
32
33
        test_pkg = "./packages/conf-test-package-257-conffiles_1.deb"
33
34
        self.assertFalse(conffile_prompt(test_pkg, prefix="./root.conffile"),
34
35
                        "conffile prompt detection incorrect")
 
36
 
 
37
    def test_will_not_prompt_because_of_conffile_removal(self):
35
38
        # no conffiles anymore in the pkg
36
39
        test_pkg = "./packages/conf-test-package-no-conffiles-anymore_2.deb"
37
40
        self.assertFalse(conffile_prompt(test_pkg, prefix="./root.conffile"),
38
41
                        "conffile prompt detection incorrect")
39
42
 
40
 
    def testWillPromptMultiple(self):
 
43
    def test_will_prompt_multiple(self):
 
44
        # multiple conffiles
41
45
        test_pkg = "./packages/multiple-conffiles_2_all.deb"
42
46
        self.assertTrue(conffile_prompt(test_pkg, prefix="./root.conffile"),
43
47
                        "conffile prompt detection incorrect")
44
48
 
 
49
    def test_will_prompt_for_new_conffile(self):
 
50
        # debian bug #673237, a package that was not a conffile now
 
51
        # becomes a conffile
 
52
        test_pkg = "./packages/conf-test-package-new-conffile_1.deb"
 
53
        self.assertTrue(conffile_prompt(test_pkg, prefix="./root.conffile"),
 
54
                        "conffile prompt detection incorrect")
 
55
 
45
56
 
46
57
if __name__ == "__main__":
47
58
    logging.basicConfig(level=logging.DEBUG)