561
|
1 import os.path
|
|
2 from unittest import TestCase
|
|
3
|
|
4 from pyntnclick.resources import Resources
|
|
5
|
|
6
|
|
7 TEST_PATH = os.path.dirname(__file__)
|
|
8 DATA_PATH = os.path.join(os.path.dirname(TEST_PATH), 'data')
|
|
9
|
|
10 test_path = lambda p: os.path.join(TEST_PATH, p)
|
|
11 data_path = lambda p: os.path.join(DATA_PATH, p)
|
|
12
|
|
13
|
|
14 class ResourcesTestCase(TestCase):
|
|
15 def test_get_paths_no_lang(self):
|
|
16 res = Resources('pyntnclick.tests')
|
|
17 self.assertEqual([test_path('thing'), data_path('thing')],
|
|
18 res.get_paths('thing'))
|
|
19
|
|
20 def test_get_paths_lang(self):
|
|
21 res = Resources('pyntnclick.tests', 'en')
|
|
22 self.assertEqual([test_path('en/thing'), test_path('thing'),
|
|
23 data_path('en/thing'), data_path('thing')],
|
|
24 res.get_paths('thing'))
|