Ejemplo n.º 1
0
    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'))
Ejemplo n.º 2
0
    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'))
Ejemplo n.º 3
0
    def test_find__with_directory(self):
        """
        Test _find() with a view that has a directory specified.

        """
        loader = _make_specloader()

        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)
Ejemplo n.º 4
0
    def test_find__with_directory(self):
        """
        Test _find() with a view that has a directory specified.

        """
        locator = self._make_locator()

        view = SampleView()
        view.template_rel_path = 'foo/bar.txt'
        self.assert_(locator._find_relative(view)[0] is not None)

        actual = locator._find(view)
        expected = os.path.abspath(os.path.join(DATA_DIR, 'foo/bar.txt'))

        self.assertEquals(actual, expected)