本文整理汇总了Python中trac.versioncontrol.api.RepositoryManager.__class__方法的典型用法代码示例。如果您正苦于以下问题:Python RepositoryManager.__class__方法的具体用法?Python RepositoryManager.__class__怎么用?Python RepositoryManager.__class__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.versioncontrol.api.RepositoryManager
的用法示例。
在下文中一共展示了RepositoryManager.__class__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import __class__ [as 别名]
#.........这里部分代码省略.........
[/trailing_a]
user = r
[/trailing_b/]
user = r
# Sub-paths
[/sub/path]
user = r
# Module usage
[module:/module_a]
user = r
[other:/module_b]
user = r
[/module_c]
user = r
[module:/module_d]
user =
[/module_d]
user = r
# Wildcards
[/wildcard]
* = r
# Special tokens
[/special/anonymous]
$anonymous = r
[/special/authenticated]
$authenticated = r
# Groups
[/groups_a]
@group1 = r
[/groups_b]
@group2 = r
[/cyclic]
@cycle1 = r
# Precedence
[module:/precedence_a]
user =
[/precedence_a]
user = r
[/precedence_b]
user = r
[/precedence_b/sub]
user =
[/precedence_b/sub/test]
user = r
[/precedence_c]
user =
@group1 = r
[/precedence_d]
@group1 = r
user =
# Aliases
[/aliases_a]
&jekyll = r
[/aliases_b]
@alias2 = r
# Scoped repository
[scoped:/scope/dir1]
joe = r
[scoped:/scope/dir2]
jane = r
""")
self.env = EnvironmentStub(enable=[AuthzSourcePolicy])
self.env.config.set('trac', 'authz_file', self.authz)
self.policy = AuthzSourcePolicy(self.env)
# Monkey-subclass RepositoryManager to serve mock repositories
rm = RepositoryManager(self.env)
class TestRepositoryManager(rm.__class__):
def get_real_repositories(self):
return set([Mock(reponame='module'),
Mock(reponame='other'),
Mock(reponame='scoped')])
def get_repository(self, reponame):
if reponame == 'scoped':
def get_changeset(rev):
if rev == 123:
def get_changes():
yield ('/dir1/file',)
elif rev == 456:
def get_changes():
yield ('/dir2/file',)
else:
def get_changes():
return iter([])
return Mock(get_changes=get_changes)
return Mock(scope='/scope',
get_changeset=get_changeset)
return Mock(scope='/')
rm.__class__ = TestRepositoryManager