def test_multiple_files(self): """Multiple leases files on azure with one found return that value.""" self.maxDiff = None populate_dir(self.lease_d, {'1': self.azure_lease, '9': self.lxd_lease}) self.assertEqual({'1': self.azure_parsed, '9': self.lxd_parsed}, networkd_load_leases(self.lease_d))
def test_single_azure_leases_file(self): """On Azure, option 245 should be present, verify it specifically.""" populate_dir(self.lease_d, {'1': self.azure_lease}) self.assertEqual( {'1': self.azure_parsed}, networkd_load_leases(self.lease_d))
def test_single_leases_file(self): """A leases dir with one leases file.""" populate_dir(self.lease_d, {'2': self.lxd_lease}) self.assertEqual( {'2': self.lxd_parsed}, networkd_load_leases(self.lease_d))
def test_no_leases_dir_returns_empty_dict(self): """A non-existing leases dir should return empty dict.""" enodir = os.path.join(self.lease_d, 'does-not-exist') self.assertEqual({}, networkd_load_leases(enodir))
def test_no_leases_returns_empty_dict(self): """A leases dir with no lease files should return empty dictionary.""" self.assertEqual({}, networkd_load_leases(self.lease_d))