def test_md_next_name_fail(self):
     self.p_scheme.mds = [
         objects.MultipleDevice('/dev/md%s' % x, 'level')
         for x in range(0, 128)
     ]
     self.assertRaises(errors.MDAlreadyExistsError,
                       self.p_scheme.md_next_name)
 def test_md_attach_by_mount_md_exists(self):
     self.assertEqual(0, len(self.p_scheme.mds))
     self.assertEqual(0, len(self.p_scheme.fss))
     expected_md = objects.MultipleDevice('name', 'level')
     expected_fs = objects.FileSystem('name', mount='mount')
     self.p_scheme.mds.append(expected_md)
     self.p_scheme.fss.append(expected_fs)
     actual_md = self.p_scheme.md_attach_by_mount('device', 'mount')
     self.assertIn('device', actual_md.devices)
     self.assertEqual(expected_md, actual_md)
 def test_md_by_mount(self):
     self.assertEqual(0, len(self.p_scheme.mds))
     self.assertEqual(0, len(self.p_scheme.fss))
     expected_md = objects.MultipleDevice('name', 'level')
     expected_fs = objects.FileSystem('name', mount='mount')
     self.p_scheme.mds.append(expected_md)
     self.p_scheme.fss.append(expected_fs)
     self.p_scheme.fss.append(objects.FileSystem('wrong_name',
                              mount='wrong_mount'))
     self.assertEqual(expected_md, self.p_scheme.md_by_mount('mount'))
 def setUp(self):
     super(self.__class__, self).setUp()
     self.md = objects.MultipleDevice(name='name', level='level')
 def test_md_by_name(self):
     self.assertEqual(0, len(self.p_scheme.mds))
     expected_md = objects.MultipleDevice('name', 'level')
     self.p_scheme.mds.append(expected_md)
     self.p_scheme.mds.append(objects.MultipleDevice('wrong_name', 'level'))
     self.assertEqual(expected_md, self.p_scheme.md_by_name('name'))