comparison pyntnclick/tests/test_resources.py @ 561:e207dfad0d9e pyntnclick

Start of resource manager.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 11 Feb 2012 15:05:34 +0200
parents
children f22953c43c6d
comparison
equal deleted inserted replaced
560:28f03563f4db 561:e207dfad0d9e
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'))