Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / test / test_shortcut.py
1 """Test win32 shortcut script
2 """
3
4 from twisted.trial import unittest
5
6 import os
7 if os.name == 'nt':
8
9     skipWindowsNopywin32 = None
10     try:
11         from twisted.python import shortcut
12     except ImportError:
13         skipWindowsNopywin32 = ("On windows, twisted.python.shortcut is not "
14                                 "available in the absence of win32com.")
15     import os.path
16     import sys
17
18     class ShortcutTest(unittest.TestCase):
19         def testCreate(self):
20             s1=shortcut.Shortcut("test_shortcut.py")
21             tempname=self.mktemp() + '.lnk'
22             s1.save(tempname)
23             self.assert_(os.path.exists(tempname))
24             sc=shortcut.open(tempname)
25             self.assert_(sc.GetPath(0)[0].endswith('test_shortcut.py'))
26     ShortcutTest.skip = skipWindowsNopywin32