1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
'''
TestStoragePath
===============
Tested platforms:
* macOS
'''
import unittest
from plyer.tests.common import platform_import, PlatformTest
class TestStoragePath(unittest.TestCase):
'''
TestCase for plyer.storagepath.
'''
@PlatformTest('macosx')
def test_storagepath_macosx(self):
'''
Test macOS for plyer.storagepath.
'''
storagepath = platform_import(
platform='macosx',
module_name='storagepath'
)
self.assertIn('OSXStoragePath', dir(storagepath))
storagepath = storagepath.instance()
self.assertIn('OSXStoragePath', str(storagepath))
path_format = 'file:///Users/'
self.assertIn(path_format, storagepath.get_home_dir())
self.assertIn('/', storagepath.get_root_dir())
self.assertIn(path_format, storagepath.get_documents_dir())
self.assertIn(path_format, storagepath.get_downloads_dir())
self.assertIn(path_format, storagepath.get_videos_dir())
self.assertIn(path_format, storagepath.get_music_dir())
self.assertIn(path_format, storagepath.get_pictures_dir())
self.assertIn(path_format, storagepath.get_application_dir())
@PlatformTest('win')
def test_storagepath_windows(self):
'''
Test win for plyer.storagepath.
'''
storagepath = platform_import(
platform='win',
module_name='storagepath'
)
self.assertIn('WinStoragePath', dir(storagepath))
storagepath = storagepath.instance()
self.assertIn('WinStoragePath', str(storagepath))
path_format = ':\\'
self.assertIn(path_format, storagepath.get_home_dir())
self.assertIn(path_format, storagepath.get_root_dir())
self.assertIn(path_format, storagepath.get_documents_dir())
self.assertIn(path_format, storagepath.get_downloads_dir())
self.assertIn(path_format, storagepath.get_videos_dir())
self.assertIn(path_format, storagepath.get_music_dir())
self.assertIn(path_format, storagepath.get_pictures_dir())
self.assertIn(path_format, storagepath.get_application_dir())
if __name__ == '__main__':
unittest.main()
|