def test_per_repo_config_is_generated_during_filesystem_repo_creation( self, tmpdir, backend, use_global_config, repo_name_passed): repo_name = 'test-{}-repo-{}'.format(backend.alias, use_global_config) config = make_db_config() model = RepoModel() with mock.patch('rhodecode.model.repo.make_db_config') as config_mock: config_mock.return_value = config model._create_filesystem_repo(repo_name, backend.alias, repo_group='', clone_uri=None, use_global_config=use_global_config) expected_repo_name = repo_name if repo_name_passed else None expected_call = mock.call(clear_session=False, repo=expected_repo_name) assert expected_call in config_mock.call_args_list
def test_create_filesystem_repo_installs_hooks(self, tmpdir, backend): hook_methods = {'git': 'install_git_hook', 'svn': 'install_svn_hooks'} repo = backend.create_repo() repo_name = repo.repo_name model = RepoModel() repo_location = tempfile.mkdtemp() model.repos_path = repo_location method = hook_methods[backend.alias] with mock.patch.object(ScmModel, method) as hooks_mock: model._create_filesystem_repo(repo_name, backend.alias, repo_group='', clone_uri=None) assert hooks_mock.call_count == 1 hook_args, hook_kwargs = hooks_mock.call_args assert hook_args[0].name == repo_name