summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAles Kozumplik <akozumpl@redhat.com>2011-09-27 10:44:02 +0200
committerAles Kozumplik <akozumpl@redhat.com>2011-09-27 10:44:02 +0200
commitfda82053a7d376aaf4e43d8359029a32ed9160c4 (patch)
tree87edf085ca6bd19fc19cf8af793f56b0b9fdc01d /tests
parente3dfa1d2621734b7bdf117e7c5469ce84b8a0ffc (diff)
downloadanaconda-fda82053a7d376aaf4e43d8359029a32ed9160c4.tar.gz
anaconda-fda82053a7d376aaf4e43d8359029a32ed9160c4.tar.xz
anaconda-fda82053a7d376aaf4e43d8359029a32ed9160c4.zip
botoloader: write 'ip=eth0:dhcp,auto6' instead of 'ip=eth0:dhcp ip=eth0:auto6'
Unit tests included. This is a loose merge from 238cca2783d564d6b92ec4e1104606627f02a9d8. Resolves: rhbz#740222
Diffstat (limited to 'tests')
-rw-r--r--tests/pyanaconda_test/bootloader_test.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/pyanaconda_test/bootloader_test.py b/tests/pyanaconda_test/bootloader_test.py
index 4173db38d..59b6ea22b 100644
--- a/tests/pyanaconda_test/bootloader_test.py
+++ b/tests/pyanaconda_test/bootloader_test.py
@@ -1,6 +1,6 @@
import mock
-class BootloaderTest(mock.TestCase):
+class ArgumentsTest(mock.TestCase):
def setUp(self):
self.setupModules(
['_isys', 'logging', 'pyanaconda.anaconda_log', 'block',
@@ -14,7 +14,7 @@ class BootloaderTest(mock.TestCase):
def tearDown(self):
self.tearDownModules()
- def test_argument(self):
+ def test_basic(self):
from pyanaconda.bootloader import Arguments
a = Arguments()
a.update(set(["a", "b", "c"]))
@@ -24,3 +24,28 @@ class BootloaderTest(mock.TestCase):
self.assertEqual(diff, set(["a", "c"]))
self.assertIsInstance(diff, Arguments)
assert(str(diff) in ["a c", "c a"])
+
+ def test_merge_ip(self):
+ from pyanaconda.bootloader import Arguments
+ # test that _merge_ip() doesnt break the simple case:
+ a = Arguments(["one", "two", "ip=eth0:dhcp"])
+ a._merge_ip()
+ self.assertEqual(a, Arguments(["one", "two", "ip=eth0:dhcp"]))
+
+ # test that it does what it's supposed to:
+ a = Arguments(["one", "two", "ip=eth0:dhcp", "ip=eth0:auto6",
+ "ip=wlan0:dhcp",
+ "ip=10.34.102.102::10.34.39.255:24:aklab:eth2:none"])
+ a._merge_ip()
+ self.assertEqual(a, set([
+ "one", "two",
+ "ip=wlan0:dhcp",
+ "ip=10.34.102.102::10.34.39.255:24:aklab:eth2:none",
+ "ip=eth0:auto6,dhcp"]))
+
+ def test_output_with_merge(self):
+ from pyanaconda.bootloader import Arguments
+ a = Arguments(["ip=eth0:dhcp"])
+ self.assertEqual(str(a), "ip=eth0:dhcp")
+ a = Arguments(["ip=eth0:dhcp", "ip=eth0:auto6"])
+ assert(str(a) in ["ip=eth0:auto6,dhcp", "ip=eth0:dhcp,auto6"])