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


Python TeamFactory.create方法代码示例

本文整理汇总了Python中tests.factories.TeamFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python TeamFactory.create方法的具体用法?Python TeamFactory.create怎么用?Python TeamFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.factories.TeamFactory的用法示例。


在下文中一共展示了TeamFactory.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_return_200_if_not_team_owner

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
 def test_get_return_200_if_not_team_owner(self):
     self._add_results()
     user = UserFactory.create(with_token=True)
     TeamFactory.create(owner=user)
     url = "/results/%s/%s/%s/%s/%s" % (self.team.name, self.project.name, self.config.module, self.config.class_name, self.config.test_name)
     response = self.fetch_with_headers(url)
     expect(response.code).to_equal(200)
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_load_test_results.py

示例2: test_show_memberships

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_show_memberships(self):
        t1 = TeamFactory.create(owner=self.user)
        t2 = TeamFactory.create(members=[self.user])
        result = self.execute("user-info")

        expected = ("""User: %s
          +--------+--------+
          | team   | role   |
          +--------+--------+
          | %s     | owner  |
          | %s     | member |
          +--------+--------+
        """ % (self.user.email, t1.name, t2.name)).replace('-', '')

        expect(result.replace('-', '')).to_be_like(expected)
开发者ID:heynemann,项目名称:wight,代码行数:17,代码来源:test_user.py

示例3: test_can_run_funkload

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_can_run_funkload(self):
        team = TeamFactory.create()
        TeamFactory.add_projects(team, 1)
        user = team.owner
        project = team.projects[0]
        load_test = LoadTestFactory.add_to_project(1, user=user, team=team, project=project)
        load_test.pressure = "small"

        conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
        test = conf.tests[0]

        DEFAULT_CYCLES = {
            "small": [10, 20],
            "medium": [10, 20, 30],
            "large": [30, 75, 100],
        }

        fl_result = FunkLoadBenchRunner.run(root_path, test, self.base_url, cycles=DEFAULT_CYCLES, duration=5)

        expect(fl_result).not_to_be_null()
        expect(fl_result.exit_code).to_equal(0)

        expect(fl_result.text).to_include("SUCCESSFUL")

        expect(fl_result.log).to_be_empty()

        expect(fl_result.result).not_to_be_null()
        expect(fl_result.config).not_to_be_null()

        result = LoadTest.get_data_from_funkload_results(fl_result.config, fl_result.result)

        load_test.add_result(result, fl_result.text)

        expect(load_test.results).to_length(1)
开发者ID:heynemann,项目名称:wight,代码行数:36,代码来源:test_run_bench.py

示例4: test_load_test_instance

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_load_test_instance(self):
        team = TeamFactory.create(owner=self.user)
        project = team.add_project("load-test-instace-acc-1", "repo", self.user)
        load_test = LoadTestFactory.create(created_by=team.owner, team=team, project_name=project.name)
        result1 = TestResultFactory.build()
        result2 = TestResultFactory.build()
        load_test.results.append(result1)
        load_test.results.append(result2)
        load_test.save()

        result = self.execute("show", load_test.uuid)
        expected_text = [
            result1.config.title,
            result1.cycles[-1].concurrent_users,
            result1.cycles[-1].request.successful_requests_per_second,
            result1.cycles[-1].request.p95,
            result1.cycles[-1].request.failed_requests,
            result1.uuid,

            result2.config.title,
            result2.cycles[-1].concurrent_users,
            result2.cycles[-1].request.successful_requests_per_second,
            result2.cycles[-1].request.p95,
            result2.cycles[-1].request.failed_requests,
            result2.uuid,
            load_test.uuid,
            load_test.status
        ]

        for expected in expected_text:
            expect(result).to_include(expected)
开发者ID:heynemann,项目名称:wight,代码行数:33,代码来源:test_load_test.py

示例5: test_delete_a_project

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
 def test_delete_a_project(self):
     team = TeamFactory.create()
     TeamFactory.add_projects(team, 1)
     project = team.projects[0]
     team.delete_project(project.name)
     retrieved = Team.objects.filter(name=team.name).first()
     expect(retrieved.projects).to_length(0)
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_project_model.py

示例6: test_try_delete_team_without_auth

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
 def test_try_delete_team_without_auth(self):
     team = TeamFactory.create(owner=self.user)
     self.user = None
     response = self.delete("/teams/anything")
     expect(response.code).to_equal(401)
     team = Team.objects.filter(name=team.name).first()
     expect(team).not_to_be_null()
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_team.py

示例7: test_add_team_member_twice

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_add_team_member_twice(self):
        user = UserFactory.create()
        team = TeamFactory.create(owner=self.user, members=[user])

        response = self.patch("/teams/%s/members" % team.name, user=user.email)
        expect(response.code).to_equal(409)
        expect(response.body).to_equal("User already team member")
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_team.py

示例8: test_create_project_with_same_name_in_different_teams

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_create_project_with_same_name_in_different_teams(self):
        team = TeamFactory.create()
        team2 = TeamFactory.create()

        team.add_project(name="test-can-create-project", repository="repo", created_by=team.owner)
        team2.add_project(name="test-can-create-project", repository="repo", created_by=team2.owner)

        retrieved = Team.objects.filter(name=team.name).first()
        expect(retrieved).not_to_be_null()
        expect(retrieved.projects).to_length(1)
        expect(retrieved.projects[0].name).to_equal(team.projects[0].name)

        retrieved = Team.objects.filter(name=team2.name).first()
        expect(retrieved).not_to_be_null()
        expect(retrieved.projects).to_length(1)
        expect(retrieved.projects[0].name).to_equal(team2.projects[0].name)
开发者ID:heynemann,项目名称:wight,代码行数:18,代码来源:test_project_model.py

示例9: setUp

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def setUp(self):
        super(DeleteTeamProjectTest, self).setUp()

        self.user = UserFactory.create(with_token=True)
        self.team = TeamFactory.create(owner=self.user)
        TeamFactory.add_projects(self.team, 1)
        TeamFactory.add_members(self.team, 2)
        self.project = self.team.projects[0]
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_project.py

示例10: test_update_team_to_empty_name

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_update_team_to_empty_name(self):
        team = TeamFactory.create(owner=self.user)

        response = self.put("/teams/%s" % team.name, name="")
        expect(response.code).to_equal(400)

        response = self.put("/teams/%s" % team.name)
        expect(response.code).to_equal(400)
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_team.py

示例11: test_try_to_delete_a_not_owner_team

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_try_to_delete_a_not_owner_team(self):
        team = TeamFactory.create(owner=UserFactory.create(with_token=True))

        response = self.delete("/teams/%s" % team.name)
        expect(response.code).to_equal(403)

        team = Team.objects.filter(name=team.name).first()
        expect(team).not_to_be_null()
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_team.py

示例12: test_get_return_403_if_not_team_owner

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
 def test_get_return_403_if_not_team_owner(self):
     user = UserFactory.create(with_token=True)
     team = TeamFactory.create(owner=user)
     url = "/teams/%s/projects/%s/load-tests/%s/results/some-result-uuid" % (
         team.name, self.project.name, self.load_test.uuid
     )
     response = self.fetch_with_headers(url)
     expect(response.code).to_equal(403)
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_auth_load_test_results.py

示例13: test_can_create_empty_team

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_can_create_empty_team(self):
        team = TeamFactory.create()

        retrieved = Team.objects(id=team.id)
        expect(retrieved.count()).to_equal(1)
        expect(retrieved.first().name).to_equal(team.name)

        expect(retrieved.first().owner.id).to_equal(team.owner.id)
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_team_model.py

示例14: test_can_update_team

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
    def test_can_update_team(self):
        team = TeamFactory.create(owner=self.user)

        result = self.execute("team-update", team.name, "new-team-name")
        expect(result).to_be_like("Updated '%s' team to 'new-team-name' in '%s' target." % (team.name, self.target))

        team = Team.objects.filter(name="new-team-name").first()
        expect(team).not_to_be_null()
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_team.py

示例15: test_update_a_project_with_name

# 需要导入模块: from tests.factories import TeamFactory [as 别名]
# 或者: from tests.factories.TeamFactory import create [as 别名]
 def test_update_a_project_with_name(self):
     team = TeamFactory.create()
     TeamFactory.add_projects(team, 1)
     project = team.projects[0]
     team.update_project(project.name, "new-name")
     retrieved = Team.objects.filter(name=team.name).first()
     expect(retrieved.projects[0].name).to_equal("new-name")
     expect(retrieved.projects[0].repository).to_equal(project.repository)
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_project_model.py


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