Пример #1
0
class TestPathOnFile(object):
    def setUp(self):
        shoebill.content_path = "/tmp/foo"
        self._p = Path(relurl="a/b/test.rst")

    def tearDown(self):
        shoebill.content_path = None
        del self._p

    def test_is_dir_on_file(self):
        assert not self._p.is_dir

    def test_basename_on_file(self):
        assert self._p.basename() == "test.rst"

    def test_as_abs_path(self):
        assert self._p.as_abs_path == "/tmp/foo/a/b/test.rst"

    def test_url_chunks(self):
        assert self._p.url_chunks() == ["a", "b", "test.rst"]

    def test_not_hidden(self):
        assert not self._p.is_hidden, "The files should not show as hidden"

    def test_hidden(self):
        self._p = Path(relurl="a/.b.rst")
        assert self._p.is_hidden, "The files should show as hidden"

    def test_repr(self):
        assert "<Path" in repr(self._p)
Пример #2
0
class TestPathOnFile(object):

    def setUp(self):
        shoebill.content_path = '/tmp/foo'
        self._p = Path(relurl='a/b/test.rst')

    def tearDown(self):
        shoebill.content_path = None
        del(self._p)

    def test_is_dir_on_file(self):
        assert not self._p.is_dir

    def test_basename_on_file(self):
        assert self._p.basename() == 'test.rst'

    def test_as_abs_path(self):
        assert self._p.as_abs_path == '/tmp/foo/a/b/test.rst'

    def test_url_chunks(self):
        assert self._p.url_chunks() == ['a', 'b', 'test.rst']

    def test_not_hidden(self):
        assert not self._p.is_hidden, "The files should not show as hidden"

    def test_hidden(self):
        self._p = Path(relurl="a/.b.rst")
        assert self._p.is_hidden, "The files should show as hidden"

    def test_repr(self):
        assert '<Path' in repr(self._p)
Пример #3
0
class TestPathOnDir(object):
    def setUp(self):
        shoebill.content_path = "/tmp/foo"
        self._p = Path(relurl="a/b/")

    def tearDown(self):
        shoebill.content_path = None

    def test_is_dir_on_dir(self):
        assert self._p.is_dir

    def test_basename_on_dir(self):
        assert self._p.basename() == "b"

    def test_as_url(self):
        p = Path(relurl="a/b/")
        assert p.as_url == "a/b/", p.as_url

    def test_url_chunks(self):
        assert self._p.url_chunks() == ["a", "b", ""]
Пример #4
0
class TestPathOnDir(object):

    def setUp(self):
        shoebill.content_path = '/tmp/foo'
        self._p = Path(relurl='a/b/')

    def tearDown(self):
        shoebill.content_path = None

    def test_is_dir_on_dir(self):
        assert self._p.is_dir

    def test_basename_on_dir(self):
        assert self._p.basename() == 'b'

    def test_as_url(self):
        p = Path(relurl='a/b/')
        assert p.as_url == 'a/b/', p.as_url

    def test_url_chunks(self):
        assert self._p.url_chunks() == ['a', 'b', '']