Пример #1
0
    def test_takes_three_args(self):
        with self.assertRaises(TypeError):
            install._remove_readonly()

        with self.assertRaises(TypeError):
            install._remove_readonly(True)

        with self.assertRaises(TypeError):
            install._remove_readonly(True, True)

        with self.assertRaises(TypeError):
            install._remove_readonly(True, True, True, True)
Пример #2
0
    def test_takes_three_args(self):
        with self.assertRaises(TypeError):
            install._remove_readonly()

        with self.assertRaises(TypeError):
            install._remove_readonly(True)

        with self.assertRaises(TypeError):
            install._remove_readonly(True, True)

        with self.assertRaises(TypeError):
            install._remove_readonly(True, True, True, True)
Пример #3
0
 def test_calls_func(self):
     some_path = generate_random_path()
     func = mock.Mock()
     with patch.object(install.os, 'chmod'):
         install._remove_readonly(func, some_path, {})
     func.assert_called_with(some_path)
Пример #4
0
 def test_calls_os_chmod(self):
     some_path = generate_random_path()
     with patch.object(install.os, 'chmod') as chmod:
         install._remove_readonly(mock.Mock(), some_path, {})
     chmod.assert_called_with(some_path, stat.S_IWRITE)