Changeset 744:3a967f693570 in hatta-dev for tests/test_repo.py
- Timestamp:
- 01/24/10 15:19:13 (2 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
tests/test_repo.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/test_repo.py
r741 r744 68 68 comment = u'test comment' 69 69 70 @py.test.mark.xfail 71 def test_filename(self, repo): 70 title_encodings = { 71 u'test title': 'test title', 72 u'.test title': '%2Etest title', 73 u'../test title': '%2E./test title', 74 u'test/./title': 'test/%2E/title', 75 u'test/../title': 'test/%2E./title', 76 u'test//title': 'test/%2Ftitle', 77 u'/test/title': '%2Ftest/title', 78 } 79 80 81 def test_title_to_file(self, subdir_repo): 82 for title, filename in self.title_encodings.iteritems(): 83 escaped = subdir_repo._title_to_file(title) 84 assert escaped == filename 85 86 def test_filename(self, subdir_repo): 72 87 """ 73 88 Check if the page's file is named properly. 74 89 """ 75 90 76 title = u'some/page.txt' 77 filename = 'some/page.txt' 78 filepath = os.path.join(repo.path, filename) 79 repo.save_text(title, self.text, self.author, self.comment, parent=-1) 80 exists = os.path.exists(filepath) 81 assert exists 82 83 # XXX Put your tests here. 91 for title, filename in self.title_encodings.iteritems(): 92 filepath = os.path.join(subdir_repo.path, filename) 93 subdir_repo.save_text(title, self.text, self.author, self.comment, 94 parent=-1) 95 exists = os.path.exists(filepath) 96 assert exists 97 84 98 85 99 class TestMercurialStorage(object): … … 105 119 exists = os.path.exists(filepath) 106 120 assert exists 121 122 def test_check_path(self, repo): 123 py.test.raises(werkzeug.exceptions.Forbidden, repo._check_path, "/") 124 py.test.raises(werkzeug.exceptions.Forbidden, repo._check_path, "..") 125 py.test.raises(werkzeug.exceptions.Forbidden, repo._check_path, 126 repo.path+"/..") 127 path = os.path.join(repo.path, 'aaa') 128 os.symlink('/', path) 129 py.test.raises(werkzeug.exceptions.Forbidden, repo._check_path, path) 130 path = os.path.join(repo.path, 'bbb') 131 os.mkdir(path) 132 py.test.raises(werkzeug.exceptions.Forbidden, repo._check_path, path) 107 133 108 134 @py.test.mark.skipif("sys.platform == 'win32'")
Note: See TracChangeset
for help on using the changeset viewer.
