def test_python_pygments(self): """Verifies that a file is properly syntax-highlighted if pygments exists""" try: import pygments except ImportError: return self.assertTrue(valet.view(self.test_python_file).find('<span class="n">__name__</span>') >= 0)
def test_raw_link(self): """Verifies that the 'raw' link is present and has the correct URL""" self.assertTrue(valet.view(self.test_file).find(self.test_file + "?raw") >= 0)
def test_readonly_edit_link_absent(self): """Verifies that the 'edit' link is absent in read-only mode""" initial = valet.READONLY valet.READONLY = True self.assertTrue(valet.view(self.test_file).find(self.test_file + "?edit") < 0) valet.READONLY = initial
def test_edit_link(self): """Verifies that the 'edit' link is present and has the correct URL""" initial = valet.READONLY valet.READONLY = False self.assertTrue(valet.view(self.test_file).find(self.test_file + "?edit") >= 0) valet.READONLY = initial
def test_file_contents(self): """Verifies that viewing a file contains the correct contents""" self.assertTrue(valet.view(self.test_file) .find("file contents present") >= 0)
def test_file_view(self): """Verifies that viewing a file does something at all""" self.assertTrue(valet.view(self.test_file).startswith("<HTML>"))
def test_directory_no_raw(self): """Verifies that the 'raw' link is absent on directories""" self.assertFalse(valet.view(self.test_subdir) .find(self.test_subdir + "?raw") >= 0)
def test_subdir_view(self): """Verifies that viewing a subdirectory does something at all""" self.assertTrue(valet.view(self.test_subdir).startswith("<HTML>"))
def test_utf8_file_correctness(self): """Verifies that viewing a UTF-8 file has the right content""" self.assertTrue(valet.view(self.test_utf8_file).find(u'ταὐτὰ παρίσταταί') >= 0)