當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。