summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pystache/tests/data/locator/template.txt1
-rw-r--r--pystache/tests/test_locator.py12
2 files changed, 12 insertions, 1 deletions
diff --git a/pystache/tests/data/locator/template.txt b/pystache/tests/data/locator/template.txt
new file mode 100644
index 0000000..bef8160
--- /dev/null
+++ b/pystache/tests/data/locator/template.txt
@@ -0,0 +1 @@
+Test template file
diff --git a/pystache/tests/test_locator.py b/pystache/tests/test_locator.py
index 8d4ec9b..ee1c2ff 100644
--- a/pystache/tests/test_locator.py
+++ b/pystache/tests/test_locator.py
@@ -19,6 +19,9 @@ from pystache.tests.common import DATA_DIR, EXAMPLES_DIR, AssertExceptionMixin
from pystache.tests.data.views import SayHello
+LOCATOR_DATA_DIR = os.path.join(DATA_DIR, 'locator')
+
+
class LocatorTests(unittest.TestCase, AssertExceptionMixin):
def _locator(self):
@@ -87,6 +90,13 @@ class LocatorTests(unittest.TestCase, AssertExceptionMixin):
self.assertEqual(locator.make_file_name('foo', template_extension='bar'), 'foo.bar')
+ def test_find_file(self):
+ locator = Locator()
+ path = locator.find_file('template.txt', [LOCATOR_DATA_DIR])
+
+ expected_path = os.path.join(LOCATOR_DATA_DIR, 'template.txt')
+ self.assertEqual(path, expected_path)
+
def test_find_name(self):
locator = Locator()
path = locator.find_name(search_dirs=[EXAMPLES_DIR], template_name='simple')
@@ -107,7 +117,7 @@ class LocatorTests(unittest.TestCase, AssertExceptionMixin):
locator = Locator()
dir1 = DATA_DIR
- dir2 = os.path.join(DATA_DIR, 'locator')
+ dir2 = LOCATOR_DATA_DIR
self.assertTrue(locator.find_name(search_dirs=[dir1], template_name='duplicate'))
self.assertTrue(locator.find_name(search_dirs=[dir2], template_name='duplicate'))