コード例 #1
0
 def test_root_dir(self):
     base_url = "/base/url/"
     rest_url = "/"
     fm = BaseFilemanager(None, self.BASE_PATH, base_url, rest_url)
     self.assertEqual(fm.abs_url, base_url)
     self.assertEqual(fm.abs_path, self.BASE_PATH)
     self.assertEqual(fm.breadcrumbs,
         [{'url': base_url, 'name': 'index', 'title': "goto 'index'"}]
     )
コード例 #2
0
 def test_subdir1(self):
     subdir = "subdir1"
     base_url = "/base/url/"
     rest_url = f"{subdir}/"
     fm = BaseFilemanager(None, self.BASE_PATH, base_url, rest_url)
     self.assertEqual(fm.abs_url, '/base/url/subdir1/')
     self.assertEqual(fm.absolute_path, self.BASE_PATH)
     self.assertEqual(fm.breadcrumbs, [
         {'url': base_url, 'name': 'index', 'title': "goto 'index'"},
         {'url': f'/base/url/{subdir}/', 'name': subdir, 'title': f"goto '{subdir}'"}
     ])
コード例 #3
0
 def test_subdir1(self):
     subdir = "subdir1"
     base_url = "/base/url/"
     rest_url = "%s/" % subdir
     fm = BaseFilemanager(None, self.BASE_PATH, base_url, rest_url)
     self.assertEqual(fm.abs_url, '/base/url/subdir1/')
     self.assertEqual(fm.abs_path, "%s%s" % (self.BASE_PATH, rest_url))
     self.assertEqual(fm.breadcrumbs, [
         {'url': base_url, 'name': 'index', 'title': "goto 'index'"},
         {'url': '/base/url/%s/' % subdir, 'name': subdir, 'title': "goto '%s'" % subdir}
     ])