diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyntnclick/tests/test_resources.py	Sat Feb 11 15:05:34 2012 +0200
@@ -0,0 +1,24 @@
+import os.path
+from unittest import TestCase
+
+from pyntnclick.resources import Resources
+
+
+TEST_PATH = os.path.dirname(__file__)
+DATA_PATH = os.path.join(os.path.dirname(TEST_PATH), 'data')
+
+test_path = lambda p: os.path.join(TEST_PATH, p)
+data_path = lambda p: os.path.join(DATA_PATH, p)
+
+
+class ResourcesTestCase(TestCase):
+    def test_get_paths_no_lang(self):
+        res = Resources('pyntnclick.tests')
+        self.assertEqual([test_path('thing'), data_path('thing')],
+                         res.get_paths('thing'))
+
+    def test_get_paths_lang(self):
+        res = Resources('pyntnclick.tests', 'en')
+        self.assertEqual([test_path('en/thing'), test_path('thing'),
+                          data_path('en/thing'), data_path('thing')],
+                         res.get_paths('thing'))