本文整理汇总了Python中tests.factories.AuthUserFactory.delete_addon方法的典型用法代码示例。如果您正苦于以下问题:Python AuthUserFactory.delete_addon方法的具体用法?Python AuthUserFactory.delete_addon怎么用?Python AuthUserFactory.delete_addon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.factories.AuthUserFactory
的用法示例。
在下文中一共展示了AuthUserFactory.delete_addon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestUserSettings
# 需要导入模块: from tests.factories import AuthUserFactory [as 别名]
# 或者: from tests.factories.AuthUserFactory import delete_addon [as 别名]
#.........这里部分代码省略.........
assert_false(
self.user_settings.verify_oauth_access(
external_account=self.external_account,
node=self.project,
metadata={'baz': 'qiz'}
)
)
def test_verify_true(self):
self.user_settings.grant_oauth_access(
external_account=self.external_account,
node=self.project
)
assert_true(
self.user_settings.verify_oauth_access(
external_account=self.external_account,
node=self.project
)
)
def test_verify_true_with_metadata(self):
self.user_settings.grant_oauth_access(
external_account=self.external_account,
node=self.project,
metadata={'foo': 'bar'}
)
assert_true(
self.user_settings.verify_oauth_access(
external_account=self.external_account,
node=self.project,
metadata={'foo': 'bar'}
)
)
def test_grant(self):
self.user_settings.grant_oauth_access(
external_account=self.external_account,
node=self.project
)
assert_equal(
self.user_settings.oauth_grants,
{
self.project._id: {
self.external_account._id: {}
}
}
)
def test_grant_not_owned(self):
self.user.external_accounts = []
with assert_raises(PermissionsError):
self.user_settings.grant_oauth_access(
external_account=self.external_account,
node=self.project
)
assert_equal(
self.user_settings.oauth_grants,
{}
)
def test_grant_metadata(self):
self.user_settings.grant_oauth_access(
external_account=self.external_account,
node=self.project,
metadata={'foo': 'bar'}
)
assert_equal(
self.user_settings.oauth_grants,
{
self.project._id: {
self.external_account._id: {'foo': 'bar'}
}
}
)
def test_on_delete(self):
node_settings = self.project.get_or_add_addon(
MockUserSettings.oauth_provider.short_name,
auth=Auth(user=self.user)
)
node_settings.set_auth(
external_account=self.external_account,
user=self.user
)
self.user.delete_addon(
MockUserSettings.oauth_provider.short_name
)
node_settings.reload()
assert_is_none(node_settings.external_account)
assert_is_none(node_settings.user_settings)