Ejemplo n.º 1
0
 def test_check_readable_exists(self):
     with unittest.mock.patch('avocado.utils.path.os.path.exists',
                              return_value=False) as mocked_exists:
         with self.assertRaises(OSError) as cm:
             path.check_readable(os.devnull)
         self.assertEqual('File "%s" does not exist' % os.devnull,
                          cm.exception.args[0])
         mocked_exists.assert_called_with(os.devnull)
Ejemplo n.º 2
0
 def test_check_readable_exists(self):
     with unittest.mock.patch("avocado.utils.path.os.path.exists",
                              return_value=False) as mocked_exists:
         with self.assertRaises(OSError) as cm:
             path.check_readable(os.devnull)
         self.assertEqual(f'File "{os.devnull}" does not exist',
                          cm.exception.args[0])
         mocked_exists.assert_called_with(os.devnull)
Ejemplo n.º 3
0
 def test_check_readable_access(self):
     with unittest.mock.patch('avocado.utils.path.os.access',
                              return_value=False) as mocked_access:
         with self.assertRaises(OSError) as cm:
             path.check_readable(os.devnull)
         self.assertEqual('File "%s" can not be read' % os.devnull,
                          cm.exception.args[0])
         mocked_access.assert_called_with(os.devnull, os.R_OK)
Ejemplo n.º 4
0
 def test_check_readable_access(self):
     with unittest.mock.patch("avocado.utils.path.os.access",
                              return_value=False) as mocked_access:
         with self.assertRaises(OSError) as cm:
             path.check_readable(os.devnull)
         self.assertEqual(f'File "{os.devnull}" can not be read',
                          cm.exception.args[0])
         mocked_access.assert_called_with(os.devnull, os.R_OK)