Commit 75030e7d by Chris Jerdonek

Addressed TODO to rename _make_locator() to _make_loader().

parent 7341e367
...@@ -266,13 +266,12 @@ class SpecLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin): ...@@ -266,13 +266,12 @@ class SpecLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
# TemplateSpec attributes or something). # TemplateSpec attributes or something).
class TemplateSpecTests(unittest.TestCase): class TemplateSpecTests(unittest.TestCase):
# TODO: rename this method to _make_loader(). def _make_loader(self):
def _make_locator(self):
return SpecLoader() return SpecLoader()
def _assert_template_location(self, view, expected): def _assert_template_location(self, view, expected):
locator = self._make_locator() loader = self._make_loader()
actual = locator._find_relative(view) actual = loader._find_relative(view)
self.assertEqual(actual, expected) self.assertEqual(actual, expected)
def test_find_relative(self): def test_find_relative(self):
...@@ -334,13 +333,13 @@ class TemplateSpecTests(unittest.TestCase): ...@@ -334,13 +333,13 @@ class TemplateSpecTests(unittest.TestCase):
Test _find() with a view that has a directory specified. Test _find() with a view that has a directory specified.
""" """
locator = self._make_locator() loader = self._make_loader()
view = SampleView() view = SampleView()
view.template_rel_path = 'foo/bar.txt' view.template_rel_path = 'foo/bar.txt'
self.assertTrue(locator._find_relative(view)[0] is not None) self.assertTrue(loader._find_relative(view)[0] is not None)
actual = locator._find(view) actual = loader._find(view)
expected = os.path.abspath(os.path.join(DATA_DIR, 'foo/bar.txt')) expected = os.path.abspath(os.path.join(DATA_DIR, 'foo/bar.txt'))
self.assertEqual(actual, expected) self.assertEqual(actual, expected)
...@@ -350,19 +349,19 @@ class TemplateSpecTests(unittest.TestCase): ...@@ -350,19 +349,19 @@ class TemplateSpecTests(unittest.TestCase):
Test _find() with a view that doesn't have a directory specified. Test _find() with a view that doesn't have a directory specified.
""" """
locator = self._make_locator() loader = self._make_loader()
view = SampleView() view = SampleView()
self.assertTrue(locator._find_relative(view)[0] is None) self.assertTrue(loader._find_relative(view)[0] is None)
actual = locator._find(view) actual = loader._find(view)
expected = os.path.abspath(os.path.join(DATA_DIR, 'sample_view.mustache')) expected = os.path.abspath(os.path.join(DATA_DIR, 'sample_view.mustache'))
self.assertEqual(actual, expected) self.assertEqual(actual, expected)
def _assert_get_template(self, custom, expected): def _assert_get_template(self, custom, expected):
locator = self._make_locator() loader = self._make_loader()
actual = locator.load(custom) actual = loader.load(custom)
self.assertEqual(type(actual), unicode) self.assertEqual(type(actual), unicode)
self.assertEqual(actual, expected) self.assertEqual(actual, expected)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment