test_settings.py
49 lines
| 1.9 KiB
| text/x-python
|
PythonLexer
r547 | from rhodecode.model.db import Repository | |||
from rhodecode.tests import * | ||||
class TestSettingsController(TestController): | ||||
def test_index(self): | ||||
self.log_user() | ||||
response = self.app.get(url(controller='settings', action='index', | ||||
r688 | repo_name=HG_REPO)) | |||
r547 | # Test response... | |||
r688 | ||||
r547 | def test_fork(self): | |||
self.log_user() | ||||
response = self.app.get(url(controller='settings', action='fork', | ||||
r688 | repo_name=HG_REPO)) | |||
r547 | ||||
def test_fork_create(self): | ||||
self.log_user() | ||||
r688 | fork_name = HG_FORK | |||
r547 | description = 'fork of vcs test' | |||
r688 | repo_name = HG_REPO | |||
r547 | response = self.app.post(url(controller='settings', action='fork_create', | |||
repo_name=repo_name), | ||||
{'fork_name':fork_name, | ||||
r688 | 'repo_type':'hg', | |||
r547 | 'description':description, | |||
'private':'False'}) | ||||
r688 | ||||
r547 | #test if we have a message that fork is ok | |||
r728 | assert 'forked %s repository as %s' \ | |||
r547 | % (repo_name, fork_name) in response.session['flash'][0], 'No flash message about fork' | |||
r688 | ||||
r547 | #test if the fork was created in the database | |||
fork_repo = self.sa.query(Repository).filter(Repository.repo_name == fork_name).one() | ||||
r688 | ||||
r547 | assert fork_repo.repo_name == fork_name, 'wrong name of repo name in new db fork repo' | |||
r567 | assert fork_repo.fork.repo_name == repo_name, 'wrong fork parrent' | |||
r688 | ||||
r547 | #test if fork is visible in the list ? | |||
response = response.follow() | ||||
#check if fork is marked as fork | ||||
response = self.app.get(url(controller='summary', action='index', | ||||
repo_name=fork_name)) | ||||
r688 | ||||
r547 | assert 'Fork of %s' % repo_name in response.body, 'no message about that this repo is a fork' | |||