当前位置: 首页>>代码示例>>Python>>正文


Python Dependency._update_team_users方法代码示例

本文整理汇总了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"]
        }
开发者ID:erezrubinstein,项目名称:aa,代码行数:70,代码来源:test_core_user_access.py


注:本文中的common.utilities.inversion_of_control.Dependency._update_team_users方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。