Ejemplo n.º 1
0
    def test_devpath_is_diskpath(self):
        devpath = '/some/path'
        st_mock = mock.Mock()
        output = utils._get_disk_of_partition(devpath, st_mock)
        self.assertEqual('/some/path', output[0])
        self.assertIs(st_mock, output[1])

        with mock.patch('os.stat') as mock_stat:
            devpath = '/some/path'
            output = utils._get_disk_of_partition(devpath)
            mock_stat.assert_called_once_with(devpath)
            self.assertEqual(devpath, output[0])
            self.assertIs(mock_stat.return_value, output[1])
Ejemplo n.º 2
0
    def test_devpath_is_diskpath(self):
        devpath = '/some/path'
        st_mock = mock.Mock()
        output = utils._get_disk_of_partition(devpath, st_mock)
        self.assertEqual('/some/path', output[0])
        self.assertIs(st_mock, output[1])

        with mock.patch('os.stat') as mock_stat:
            devpath = '/some/path'
            output = utils._get_disk_of_partition(devpath)
            mock_stat.assert_called_once_with(devpath)
            self.assertEqual(devpath, output[0])
            self.assertIs(mock_stat.return_value, output[1])
Ejemplo n.º 3
0
 def test_stat_oserror(self, mock_stat):
     st_mock = mock.Mock()
     devpath = '/some/path1'
     output = utils._get_disk_of_partition(devpath, st_mock)
     mock_stat.assert_called_once_with('/some/path')
     self.assertEqual(devpath, output[0])
     self.assertIs(st_mock, output[1])
Ejemplo n.º 4
0
 def test_stat_oserror(self, mock_stat):
     st_mock = mock.Mock()
     devpath = '/some/path1'
     output = utils._get_disk_of_partition(devpath, st_mock)
     mock_stat.assert_called_once_with('/some/path')
     self.assertEqual(devpath, output[0])
     self.assertIs(st_mock, output[1])
Ejemplo n.º 5
0
 def test_diskpath_is_not_block_device(self, mock_stat, mock_isblk):
     st_mock = mock.Mock()
     devpath = '/some/path1'
     output = utils._get_disk_of_partition(devpath, st_mock)
     self.assertEqual(devpath, output[0])
     self.assertEqual(st_mock, output[1])
Ejemplo n.º 6
0
 def test_diskpath_is_not_block_device(self, mock_stat, mock_isblk):
     st_mock = mock.Mock()
     devpath = '/some/path1'
     output = utils._get_disk_of_partition(devpath, st_mock)
     self.assertEqual(devpath, output[0])
     self.assertEqual(st_mock, output[1])