本文整理匯總了Python中common.utilities.inversion_of_control.Dependency._update_team_users方法的典型用法代碼示例。如果您正苦於以下問題:Python Dependency._update_team_users方法的具體用法?Python Dependency._update_team_users怎麽用?Python Dependency._update_team_users使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency._update_team_users方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestCoreUserAccess
# 需要導入模塊: from common.utilities.inversion_of_control import Dependency [as 別名]
# 或者: from common.utilities.inversion_of_control.Dependency import _update_team_users [as 別名]
#.........這裏部分代碼省略.........
# Add user to teams
team_ids = [team1["id"], team2["id"]]
self.user_access.update_user(user1["id"], {"team_ids": team_ids})
industry_ids = [industry_id1, industry_id2]
self.user_access.update_team(team1["id"], {"industry_ids": industry_ids})
team_industries = self.user_access.find_team_industries({"team_id": team1["id"]})
industry_id_list = [team_industry["industry_id"] for team_industry in team_industries]
self.assertEqual(industry_id_list, industry_ids)
user_industry_list = self.user_access.get_user_industries(user1["id"])
self.assertEqual(user_industry_list, industry_ids)
def test_create_team__new_team__with_industries(self):
"""
Tests that the create team works as expected.
Added as a test for RET-1102
"""
# create various mock items
mock_team = {
"id": "chicken_woot",
"name": "woot",
"description": "chicken",
"is_generalist": False,
"user_ids": ["yoyoma"],
"industry_ids": ["danger_zone"]
}
# stub several functions
self.mox.StubOutWithMock(self.user_access, "find_team")
self.user_access.datastore = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(self.user_access, "_update_team_users")
self.mox.StubOutWithMock(self.user_access, "_update_team_industries")
# record
self.user_access.find_team({ "name": "woot" })
self.user_access.datastore.create_team(name = "woot", description = "chicken", is_generalist = False).AndReturn(mock_team)
self.user_access._update_team_users("chicken_woot", ["yoyoma"])
self.user_access._update_team_industries("chicken_woot", ["danger_zone"])
# replay
self.mox.ReplayAll()
# bomboj for
team = self.user_access.create_team(mock_team)
# make sure team is correct
self.assertEquals(team, mock_team)
def test_create_team__new_team__none_unique_name(self):
"""
Tests that the create team works as expected.
Added as a test for RET-1102
"""
# create various mock items
mock_team = {
"id": "chicken_woot",
"name": "woot",
"description": "chicken",
"is_generalist": False,
"user_ids": ["yoyoma"],
"industry_ids": ["danger_zone"]
}