本文整理汇总了Python中tests.factories.RegistrationFactory.get_admin_contributors_recursive方法的典型用法代码示例。如果您正苦于以下问题:Python RegistrationFactory.get_admin_contributors_recursive方法的具体用法?Python RegistrationFactory.get_admin_contributors_recursive怎么用?Python RegistrationFactory.get_admin_contributors_recursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.factories.RegistrationFactory
的用法示例。
在下文中一共展示了RegistrationFactory.get_admin_contributors_recursive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_make_child_embargoed_registration_public_asks_all_admins_in_tree
# 需要导入模块: from tests.factories import RegistrationFactory [as 别名]
# 或者: from tests.factories.RegistrationFactory import get_admin_contributors_recursive [as 别名]
def test_make_child_embargoed_registration_public_asks_all_admins_in_tree(self, mock_ask):
# Initiate and approve embargo
node = NodeFactory(creator=self.user)
c1 = AuthUserFactory()
child = NodeFactory(parent=node, creator=c1)
c2 = AuthUserFactory()
NodeFactory(parent=child, creator=c2)
registration = RegistrationFactory(project=node)
registration.embargo_registration(
self.user,
datetime.datetime.utcnow() + datetime.timedelta(days=10)
)
for user_id, embargo_tokens in registration.embargo.approval_state.iteritems():
approval_token = embargo_tokens['approval_token']
registration.embargo.approve_embargo(User.load(user_id), approval_token)
self.registration.save()
res = self.app.post(
registration.api_url_for('project_set_privacy', permissions='public'),
auth=self.user.auth
)
assert_equal(res.status_code, 200)
asked_admins = [(admin._id, n._id) for admin, n in mock_ask.call_args[0][0]]
for admin, node in registration.get_admin_contributors_recursive():
assert_in((admin._id, node._id), asked_admins)