from rhodecode.tests import * class TestFilesController(TestController): def test_index(self): self.log_user() response = self.app.get(url(controller='files', action='index', repo_name=HG_REPO, revision='tip', f_path='/')) # Test response... assert 'docs' in response.body, 'missing dir' assert 'tests' in response.body, 'missing dir' assert 'vcs' in response.body, 'missing dir' assert '.hgignore' in response.body, 'missing file' assert 'MANIFEST.in' in response.body, 'missing file' def test_index_revision(self): self.log_user() response = self.app.get(url(controller='files', action='index', repo_name=HG_REPO, revision='7ba66bec8d6dbba14a2155be32408c435c5f4492', f_path='/')) #Test response... assert 'docs' in response.body, 'missing dir' assert 'tests' in response.body, 'missing dir' assert 'README.rst' in response.body, 'missing file' assert '1.1 KiB' in response.body, 'missing size of setup.py' assert 'text/x-python' in response.body, 'missing mimetype of setup.py' def test_index_different_branch(self): self.log_user() response = self.app.get(url(controller='files', action='index', repo_name=HG_REPO, revision='97e8b885c04894463c51898e14387d80c30ed1ee', f_path='/')) assert """branch: git""" in response.body, 'missing or wrong branch info' def test_index_paging(self): self.log_user() for r in [(73, 'a066b25d5df7016b45a41b7e2a78c33b57adc235'), (92, 'cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e'), (109, '75feb4c33e81186c87eac740cee2447330288412'), (1, '3d8f361e72ab303da48d799ff1ac40d5ac37c67e'), (0, 'b986218ba1c9b0d6a259fac9b050b1724ed8e545')]: response = self.app.get(url(controller='files', action='index', repo_name=HG_REPO, revision=r[1], f_path='/')) assert """@ r%s:%s""" % (r[0], r[1][:12]) in response.body, 'missing info about current revision' def test_file_source(self): self.log_user() response = self.app.get(url(controller='files', action='index', repo_name=HG_REPO, revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', f_path='vcs/nodes.py')) #test or history assert """ """ in response.body assert """