def test_find_relative__template_rel_path__file_name_with_directory(self): """ Test _find_relative(): template_rel_path attribute. """ view = SampleView() view.template_rel_path = 'foo/bar/template.txt' self._assert_template_location(view, ('foo/bar', 'template.txt'))
def test_find_relative__template_rel_path__file_name_only(self): """ Test _find_relative(): template_rel_path attribute. """ view = SampleView() view.template_rel_path = 'template.txt' self._assert_template_location(view, ('', 'template.txt'))
def test_find__with_directory(self): """ Test _find() with a view that has a directory specified. """ loader = self._make_loader() view = SampleView() view.template_rel_path = 'foo/bar.txt' self.assertTrue(loader._find_relative(view)[0] is not None) actual = loader._find(view) expected = os.path.join(DATA_DIR, 'foo/bar.txt') self.assertPaths(actual, expected)
def test_find__with_directory(self): """ Test _find() with a view that has a directory specified. """ loader = self._make_loader() view = SampleView() view.template_rel_path = 'foo/bar.txt' self.assertTrue(loader._find_relative(view)[0] is not None) actual = loader._find(view) expected = os.path.join(DATA_DIR, 'foo/bar.txt') self._assert_paths(actual, expected)