本文整理汇总了Python中common.utilities.inversion_of_control.Dependency.update_team方法的典型用法代码示例。如果您正苦于以下问题:Python Dependency.update_team方法的具体用法?Python Dependency.update_team怎么用?Python Dependency.update_team使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.update_team方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCoreUserAccess
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import update_team [as 别名]
#.........这里部分代码省略.........
# reset mocks & stubs
m.ResetAll()
m.UnsetStubs()
m.StubOutWithMock(utils, "encrypt_password")
m.StubOutWithMock(utils, "verify_password")
m.StubOutWithMock(base64, "b64encode")
m.StubOutWithMock(os, "urandom")
utils.encrypt_password("yoda").AndReturn("the force")
utils.verify_password("yoda", None).AndReturn(True)
# mock the urandom return for the salt, and make sure that gets base-64 encoded into something different
os.urandom(128).AndReturn("obi-wan")
base64.b64encode("obi-wan").AndReturn("darth vader")
m.ReplayAll()
updated_user = self.user_access.update_user(user["id"], {"password": "yoda"})
# we should have "encrypted" the password "yoda" to "the force", and added a new salt
self.assertEqual(updated_user["password"], "the force")
self.assertEqual(updated_user["salt"], "darth vader")
def test_team_basic_crud(self):
team_dict = self.__get_team_dict()
team = self.user_access.create_team(team_dict)
self.assertIn("id", team)
self.assertEqual(team_dict["name"], team["name"])
self.assertEqual(team_dict["description"], team["description"])
self.assertEqual(team_dict["is_generalist"], team["is_generalist"])
team2 = self.user_access.update_team(team["id"], {"name": "asdfasdf"})
self.assertEqual(team2["name"], "asdfasdf")
self.assertEqual(team2["id"], team["id"])
team3 = self.user_access.get_team(team2["id"])
self.assertEqual(team2, team3)
result = self.user_access.delete_team(team3["id"])
self.assertEqual(result, True)
no_team = self.user_access.get_team(team2["id"])
self.assertEqual(no_team, None)
def test_team_create_with_users_and_industries(self):
# create stub
m = Mox()
m.StubOutWithMock(utils, "encrypt_password")
m.StubOutWithMock(base64, "b64encode")
# start recording
# can't seem to stub os.urandom here... returns None sometimes?
base64.b64encode(IsA(str)).AndReturn("Larry")
utils.encrypt_password("test")
base64.b64encode(IsA(str)).AndReturn("Moe")
utils.encrypt_password("test")
base64.b64encode(IsA(str)).AndReturn("Curly")
utils.encrypt_password("test")
m.ReplayAll()