/usr/share/pyshared/vamos/Config_test.py is in undertaker 1.3b-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # Copyright (C) 2012 Valentin Rothberg <valentinrothberg@googlemail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
import unittest2 as t
import tempfile
from vamos.Config import Config
class TestConfig(t.TestCase):
def setUp(self):
self.configA = tempfile.NamedTemporaryFile()
self.configB = tempfile.NamedTemporaryFile()
self.configA.file.write("""CONFIG_A=y
CONFIG_B=y
CONFIG_C=n
CONFIG_M=m""")
self.configA.file.flush()
self.configB.file.write("""CONFIG_A=y
CONFIG_B=n
CONFIG_C=y
CONFIG_M=n""")
self.configB.file.flush()
def test_readConfigFile(self):
confA = Config(self.configA.name)
self.assertTrue(confA.contains("CONFIG_A"))
def test_valueOf(self):
confA = Config()
confA.readConfigFile(self.configA.name)
self.assertEqual(confA.valueOf("CONFIG_A"),"y")
def test_addFeature(self):
confA = Config()
confA.addFeature("CONFIG_FOO","m")
self.assertEqual(confA.valueOf("CONFIG_FOO"),"m")
def test_conflict(self):
confA = Config()
confA.readConfigFile(self.configA.name)
confB = Config()
confB.readConfigFile(self.configB.name)
self.assertTrue(confA.conflict(confB))
def test_getConflicts(self):
confA = Config()
confA.readConfigFile(self.configA.name)
confB = Config()
confB.readConfigFile(self.configB.name)
conflicts = confA.getConflicts(confB)
self.assertIn("CONFIG_B",conflicts)
self.assertIn("CONFIG_C",conflicts)
self.assertIn("CONFIG_M",conflicts)
if __name__ == '__main__':
t.main()
|