Example #1
0
 def testSaveAndDelete(self):
     persistence = Config(self.tempdir)
     persistence.setNetwork(NETWORK, NETWORK_ATTRIBUTES)
     filePath = os.path.join(self.tempdir, 'nets', NETWORK)
     self.assertFalse(os.path.exists(filePath))
     persistence.save()
     self.assertTrue(os.path.exists(filePath))
     persistence.delete()
     self.assertFalse(os.path.exists(filePath))
Example #2
0
 def testSaveAndDelete(self):
     persistence = Config(self.tempdir)
     persistence.setNetwork(NETWORK, NETWORK_ATTRIBUTES)
     filePath = os.path.join(self.tempdir, 'nets', NETWORK)
     self.assertFalse(os.path.exists(filePath))
     persistence.save()
     self.assertTrue(os.path.exists(filePath))
     persistence.delete()
     self.assertFalse(os.path.exists(filePath))
Example #3
0
    def testSaveAndDelete(self):
        persistence = Config(self.tempdir)
        persistence.setNetwork(NETWORK, NETWORK_ATTRIBUTES)
        persistence.setBonding(BONDING, BONDING_ATTRIBUTES)
        persistence.set_device(DEVICE, DEVICE_ATTRIBUTES)

        net_path = os.path.join(self.tempdir, NETCONF_NETS, NETWORK)
        bond_path = os.path.join(self.tempdir, NETCONF_BONDS, BONDING)
        device_path = os.path.join(self.tempdir, NETCONF_DEVS, DEVICE)
        self.assertFalse(os.path.exists(net_path))
        self.assertFalse(os.path.exists(bond_path))
        self.assertFalse(os.path.exists(device_path))

        persistence.save()
        self.assertTrue(os.path.exists(net_path))
        self.assertTrue(os.path.exists(bond_path))
        self.assertTrue(os.path.exists(device_path))

        persistence.delete()
        self.assertFalse(os.path.exists(net_path))
        self.assertFalse(os.path.exists(bond_path))
        self.assertFalse(os.path.exists(device_path))
Example #4
0
    def testSaveAndDelete(self):
        persistence = Config(self.tempdir)
        persistence.setNetwork(NETWORK, NETWORK_ATTRIBUTES)
        persistence.setBonding(BONDING, BONDING_ATTRIBUTES)
        persistence.set_device(DEVICE, DEVICE_ATTRIBUTES)

        net_path = os.path.join(self.tempdir, NETCONF_NETS, NETWORK)
        bond_path = os.path.join(self.tempdir, NETCONF_BONDS, BONDING)
        device_path = os.path.join(self.tempdir, NETCONF_DEVS, DEVICE)
        self.assertFalse(os.path.exists(net_path))
        self.assertFalse(os.path.exists(bond_path))
        self.assertFalse(os.path.exists(device_path))

        persistence.save()
        self.assertTrue(os.path.exists(net_path))
        self.assertTrue(os.path.exists(bond_path))
        self.assertTrue(os.path.exists(device_path))

        persistence.delete()
        self.assertFalse(os.path.exists(net_path))
        self.assertFalse(os.path.exists(bond_path))
        self.assertFalse(os.path.exists(device_path))
Example #5
0
    def testSaveAndDelete(self, netconf_dir):
        persistence = Config(netconf_dir)
        persistence.setNetwork(NETWORK, NETWORK_ATTRIBUTES)
        persistence.setBonding(BONDING, BONDING_ATTRIBUTES)
        persistence.set_device(DEVICE, DEVICE_ATTRIBUTES)

        net_path = os.path.join(netconf_dir, NETCONF_NETS, NETWORK)
        bond_path = os.path.join(netconf_dir, NETCONF_BONDS, BONDING)
        device_path = os.path.join(netconf_dir, NETCONF_DEVS, DEVICE)
        assert not os.path.exists(net_path)
        assert not os.path.exists(bond_path)
        assert not os.path.exists(device_path)

        persistence.save()
        assert os.path.exists(net_path)
        assert os.path.exists(bond_path)
        assert os.path.exists(device_path)

        persistence.delete()
        assert not os.path.exists(net_path)
        assert not os.path.exists(bond_path)
        assert not os.path.exists(device_path)