Re: [master 1/2] Fix broken unit tests (cmdline, network).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack.

On 07/26/2011 01:33 PM, Ales Kozumplik wrote:
---
  pyanaconda/cmdline.py                 |   19 ++++++++++---------
  tests/pyanaconda_test/network_test.py |   32 ++++++++++----------------------
  2 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/pyanaconda/cmdline.py b/pyanaconda/cmdline.py
index 5b3e7a2..f45ea93 100644
--- a/pyanaconda/cmdline.py
+++ b/pyanaconda/cmdline.py
@@ -34,6 +34,16 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
  import logging
  log = logging.getLogger("anaconda")

+
+def setupProgressDisplay(anaconda):
+    if anaconda.dir == DISPATCH_BACK:
+        anaconda.intf.setInstallProgressClass(None)
+        return DISPATCH_BACK
+    else:
+        anaconda.intf.setInstallProgressClass(progressDisplay())
+
+    return DISPATCH_FORWARD
+
  stepToClasses = { "install" : setupProgressDisplay }

  class WaitWindow:
@@ -200,12 +210,3 @@ class progressDisplay:
          if stripped != self.display:
              self.display = stripped
              print(self.display)
-
-def setupProgressDisplay(anaconda):
-    if anaconda.dir == DISPATCH_BACK:
-        anaconda.intf.setInstallProgressClass(None)
-        return DISPATCH_BACK
-    else:
-        anaconda.intf.setInstallProgressClass(progressDisplay())
-
-    return DISPATCH_FORWARD
diff --git a/tests/pyanaconda_test/network_test.py b/tests/pyanaconda_test/network_test.py
index 6a0b324..1b867e0 100644
--- a/tests/pyanaconda_test/network_test.py
+++ b/tests/pyanaconda_test/network_test.py
@@ -38,8 +38,6 @@ class NetworkTest(mock.TestCase):

          # Network mock
          pyanaconda.network.Network.update = mock.Mock()
-        self.controlWireless_backup = pyanaconda.network.Network.controlWireless
-        pyanaconda.network.Network.controlWireless = mock.Mock()
          self.setNMControlledDevices_backup = pyanaconda.network.Network.setNMControlledDevices
          pyanaconda.network.Network.setNMControlledDevices = mock.Mock()
          pyanaconda.network.Network.netdevices = {}
@@ -434,26 +432,16 @@ class NetworkTest(mock.TestCase):
          ret = nw.getOnbootControlledIfaces()
          self.assertEqual(ret, ['dev'])

-    def network_update_ifcfg_ssid_test(self):
+    def network_writeSSIDifcfgs_test(self):
          import pyanaconda.network
          nw = pyanaconda.network.Network()
          nw.netdevices = {'dev': mock.Mock()}
-        ret = nw.updateIfcfgsSSID({'dev': ['net_essid']})
-        self.assertEqual(nw.netdevices['dev'].method_calls[0],
-            ('set', (('ESSID', 'net_essid'),), {}))
-        self.assertEqual(nw.netdevices['dev'].method_calls[1],
-            ('writeIfcfgFile', (), {}))
-
-    def network_control_wireless_test(self):
-        import pyanaconda.network
-        pyanaconda.network.isys = mock.Mock()
-        pyanaconda.network.isys.isWirelessDevice.return_value = True
-        nw = pyanaconda.network.Network()
-        pyanaconda.network.Network.controlWireless = self.controlWireless_backup
-        nw.netdevices['dev'] = mock.Mock()
-        nw.controlWireless()
-        self.assertEqual(nw.netdevices['dev'].method_calls,
-            [('set', (('NM_CONTROLLED', 'yes'),), {})])
+        ret = nw.writeSSIDifcfgs({'dev': ['net_essid']})
+        self.assertEqual(self.fs['/tmp/etc/sysconfig/network-scripts/ifcfg-net_essid'],
+                         "NAME=net_essid\n"
+                         "TYPE=Wireless\n"
+                         "ESSID=net_essid\n"
+                         "NM_CONTROLLED=yes\n")

      def network_write_ks_test(self):
          import pyanaconda.network
@@ -509,6 +497,8 @@ class NetworkTest(mock.TestCase):
      def network_copy_config_to_path_test(self):
          import pyanaconda.network
          pyanaconda.network.Network._copyFileToPath = mock.Mock()
+        pyanaconda.network.Network._copyIfcfgFiles = mock.Mock()
+

          nw = pyanaconda.network.Network()
          nw.netdevices['dev'] = mock.Mock()
@@ -516,9 +506,7 @@ class NetworkTest(mock.TestCase):
          nw.netdevices['dev'].keyfilePath = self.DEV_KEY_FILE
          ret = nw.copyConfigToPath('')
          self.assertEqual(pyanaconda.network.Network._copyFileToPath.call_args_list,
-            [(('/tmp/etc/sysconfig/network-scripts/ifcfg-eth0', ''), {}),
-             (('/tmp/etc/sysconfig/network-scripts/keys-eth0', ''), {}),
-             (('/etc/dhcp/dhclient-dev.conf', ''), {}),
+            [(('/etc/dhcp/dhclient-dev.conf', ''), {}),
               (('/tmp/etc/sysconfig/network', ''), {'overwrite': 0}),
               (('/etc/resolv.conf', ''), {'overwrite': 0}),
               (('/etc/udev/rules.d/70-persistent-net.rules', ''), {'overwrite': 0})]

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux