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)
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)
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)