Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
afe2ab59
Commit
afe2ab59
authored
Jul 23, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a unit test for Locator.find_file().
parent
440064b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
pystache/tests/data/locator/template.txt
+1
-0
pystache/tests/test_locator.py
+11
-1
No files found.
pystache/tests/data/locator/template.txt
0 → 100644
View file @
afe2ab59
Test template file
pystache/tests/test_locator.py
View file @
afe2ab59
...
...
@@ -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'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment