8
8
from unattended_upgrade import conffile_prompt
10
class TestConffilePrompt(unittest.TestCase):
10
class ConffilePromptTestCase(unittest.TestCase):
12
13
apt_pkg.config.set("Dir::State::status",
13
14
"./root.conffile/var/lib/dpkg/status")
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")
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")
29
def testWillNotPrompt(self):
30
def test_with_many_entries(self):
30
31
# ensure we don't crash when encountering a conffile with overly
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")
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")
40
def testWillPromptMultiple(self):
43
def test_will_prompt_multiple(self):
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")
49
def test_will_prompt_for_new_conffile(self):
50
# debian bug #673237, a package that was not a conffile now
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")
46
57
if __name__ == "__main__":
47
58
logging.basicConfig(level=logging.DEBUG)