diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-01-17 18:59:53 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-01-17 18:59:53 +0000 |
| commit | bb672fe3c2e2a90fa149ba575e36d45c7a4271f7 (patch) | |
| tree | f05e29160d25cb78df6dea6a387250c0f83afb1a /repoze/bfg/tests/test_view.py | |
| parent | 41887b33bce0238db87d76cbf1026e534477c0bd (diff) | |
| download | pyramid-bb672fe3c2e2a90fa149ba575e36d45c7a4271f7.tar.gz pyramid-bb672fe3c2e2a90fa149ba575e36d45c7a4271f7.tar.bz2 pyramid-bb672fe3c2e2a90fa149ba575e36d45c7a4271f7.zip | |
- Allow the ``repoze.bfg.view.static`` helper to be passed a relative
``root_path`` name; it will be considered relative to the file in
which it was called.
Diffstat (limited to 'repoze/bfg/tests/test_view.py')
| -rw-r--r-- | repoze/bfg/tests/test_view.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/repoze/bfg/tests/test_view.py b/repoze/bfg/tests/test_view.py index 53c0248ed..ca1037a67 100644 --- a/repoze/bfg/tests/test_view.py +++ b/repoze/bfg/tests/test_view.py @@ -432,24 +432,34 @@ class TestStaticView(unittest.TestCase, BaseTest): from repoze.bfg.view import static return static - def _getHere(self): + def _makeOne(self, path): + return self._getTargetClass()(path) + + def test_abspath(self): import os - return os.path.dirname(__file__) + path = os.path.dirname(__file__) + view = self._makeOne(path) + context = DummyContext() + request = DummyRequest() + request.subpath = ['__init__.py'] + request.environ = self._makeEnviron() + response = view(context, request) + self.assertEqual(request.copied, True) + self.assertEqual(response.directory, path) - def _makeOne(self): - here = self._getHere() - return self._getTargetClass()(here) - - def test_it(self): - view = self._makeOne() + def test_relpath(self): + import os + path = 'fixtures' + view = self._makeOne(path) context = DummyContext() request = DummyRequest() request.subpath = ['__init__.py'] request.environ = self._makeEnviron() response = view(context, request) self.assertEqual(request.copied, True) - here = self._getHere() - self.assertEqual(response.directory, here) + here = os.path.abspath(os.path.dirname(__file__)) + abspath = os.path.join(here, 'fixtures') + self.assertEqual(response.directory, abspath) class TestBFGViewDecorator(unittest.TestCase): def setUp(self): |
