Changeset 739:11bdf1dc2e4b in hatta-dev for tests/test_repo.py


Ignore:
Timestamp:
01/24/10 13:16:02 (2 years ago)
Author:
sheep@…
Branch:
default
Message:

add more tests for directories and symlinks, fix some related errors in Hatta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_repo.py

    r738 r739  
    101101        assert self.title not in repo 
    102102 
     103    def test_directory_read(self, repo): 
     104        """ 
     105        What happens when you try to read a directory as page. 
     106        """ 
     107 
     108        path = os.path.join(repo.path, self.filename) 
     109        os.mkdir(path) 
     110        py.test.raises(werkzeug.exceptions.Forbidden, repo.open_page, 
     111                       self.title) 
     112 
     113    def test_directory_write(self, repo): 
     114        """ 
     115        What happens when you try to write a directory as page. 
     116        """ 
     117 
     118        path = os.path.join(repo.path, self.filename) 
     119        os.mkdir(path) 
     120        py.test.raises(werkzeug.exceptions.Forbidden, repo.save_text, 
     121                       self.title, self.text, self.author, self.comment, 
     122                       parent=-1) 
     123 
     124    def test_directory_delete(self, repo): 
     125        """ 
     126        What happens when you try to delete a directory as page. 
     127        """ 
     128 
     129        path = os.path.join(repo.path, self.filename) 
     130        os.mkdir(path) 
     131        py.test.raises(werkzeug.exceptions.Forbidden, repo.delete_page, 
     132                       self.title, self.author, self.comment) 
     133 
     134    def test_symlink_delete(self, repo): 
     135        """ 
     136        What happens when you try to delete a symlink as page. 
     137        """ 
     138 
     139        path = os.path.join(repo.path, self.filename) 
     140        os.symlink('/', path) 
     141        py.test.raises(werkzeug.exceptions.Forbidden, repo.delete_page, 
     142                       self.title, self.author, self.comment) 
     143 
    103144class TestStorage(object): 
    104145    """ 
Note: See TracChangeset for help on using the changeset viewer.