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


Python factories.TeamFactory类代码示例

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


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

示例1: test_get_return_200_if_not_team_owner

 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,代码行数:7,代码来源:test_load_test_results.py

示例2: test_can_run_funkload

    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,代码行数:34,代码来源:test_run_bench.py

示例3: test_delete_a_project

 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,代码行数:7,代码来源:test_project_model.py

示例4: test_update_a_project_with_name

 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,代码行数:8,代码来源:test_project_model.py

示例5: setUp

    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,代码行数:8,代码来源:test_project.py

示例6: test_get_last_3_load_tests_for_all_projects_when_owner

 def test_get_last_3_load_tests_for_all_projects_when_owner(self):
     LoadTestFactory.add_to_project(4, user=self.user, team=self.team, project=self.project)
     LoadTestFactory.add_to_project(4, user=self.user, team=self.team, project=self.team.projects[1])
     team = TeamFactory.create(owner=self.user)
     TeamFactory.add_projects(team, 1)
     LoadTestFactory.add_to_project(4, user=self.user, team=team, project=team.projects[0])
     LoadTestFactory.add_to_project(4, user=UserFactory.create())
     loaded_tests = list(LoadTest.get_by_user(self.user))
     expect(loaded_tests).to_length(9)
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_loadtest_model.py

示例7: test_get_project_by_team_should_be_a_equal_to_project_dict

 def test_get_project_by_team_should_be_a_equal_to_project_dict(self):
     TeamFactory.add_projects(self.team, 2)
     project = self.team.projects[1]
     response = self.fetch_with_headers("/teams/%s/projects/%s" % (self.team.name, project.name))
     expect(response.code).to_equal(200)
     obj = response.body
     if isinstance(obj, six.binary_type):
         obj = obj.decode('utf-8')
     expect(loads(obj)).to_be_like(project.to_dict())
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_project.py

示例8: test_can_create_team_with_members

    def test_can_create_team_with_members(self):
        team = TeamFactory.create()
        TeamFactory.add_members(team, 1)

        retrieved = Team.objects(id=team.id)
        expect(retrieved.count()).to_equal(1)
        expect(retrieved.first().name).to_equal(team.name)
        expect(retrieved.first().members).to_length(1)
        expect(retrieved.first().members[0].email).to_equal(team.members[0].email)
开发者ID:heynemann,项目名称:wight,代码行数:9,代码来源:test_team_model.py

示例9: setUp

 def setUp(self):
     super(ShowTestResultForTeamProjectAndTestTest, self).setUp()
     self.user = UserFactory.create(with_token=True)
     self.team = TeamFactory.create(owner=self.user)
     TeamFactory.add_projects(self.team, 2)
     self.project = self.team.projects[0]
     self.load_test = LoadTestFactory.create(created_by=self.user, team=self.team, project_name=self.project.name, status="Finished")
     self.load_test.save()
     self.config = TestConfigurationFactory.build()
     self.config2 = TestConfigurationFactory.build()
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_load_test_results.py

示例10: test_can_create_project_being_a_member

    def test_can_create_project_being_a_member(self):
        team = TeamFactory.create()
        TeamFactory.add_members(team, 2)
        team.add_project(name="test-can-create-project-being-a-member", repository="repo", created_by=team.members[0])

        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)
        expect(retrieved.projects[0].repository).to_equal(team.projects[0].repository)
开发者ID:heynemann,项目名称:wight,代码行数:10,代码来源:test_project_model.py

示例11: test_list_load_tests_by_team_and_project

    def test_list_load_tests_by_team_and_project(self):
        team = TeamFactory.create(owner=self.user)
        TeamFactory.add_projects(team, 1)
        project = team.projects[0]
        LoadTestFactory.add_to_project(25, user=self.user, team=team, project=project)

        load_tests = LoadTest.get_sliced_by_team_and_project_name(team, project.name, 20)
        uuids = _get_print_lines_for_load_tests(load_tests)

        result = self.execute("list", team=team.name, project=project.name)
        expect(result).to_be_like(BASE_LOAD_TESTS_TABLE_PRINT % (team.name, project.name, "".join(uuids)))
开发者ID:heynemann,项目名称:wight,代码行数:11,代码来源:test_load_test.py

示例12: test_can_git_clone_in_specific_branch

    def test_can_git_clone_in_specific_branch(
        self, run_config_mock, load_config_mock, validate_mock, save_mock, clone_mock
    ):
        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, branch="test")

        runner = BenchRunner()
        runner.run_project_tests("some-path-doesnt-matter", str(load_test.uuid), duration=1)
        expect(clone_mock.call_args_list[0][1]["branch"]).to_be_like("test")
开发者ID:heynemann,项目名称:wight,代码行数:12,代码来源:test_run_bench.py

示例13: test_get_project_by_team_should_be_a_json

 def test_get_project_by_team_should_be_a_json(self):
     TeamFactory.add_projects(self.team, 2)
     project = self.team.projects[1]
     response = self.fetch_with_headers("/teams/%s/projects/%s" % (self.team.name, project.name))
     expect(response.code).to_equal(200)
     obj = response.body
     if isinstance(obj, six.binary_type):
         obj = obj.decode('utf-8')
     try:
         loads(obj)
         assert True
     except ValueError:
         raise AssertionError("Should be possible to load a json from response")
开发者ID:heynemann,项目名称:wight,代码行数:13,代码来源:test_project.py

示例14: test_show_memberships

    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,代码行数:15,代码来源:test_user.py

示例15: test_can_schedule_in_specific_branch

    def test_can_schedule_in_specific_branch(self):
        team = TeamFactory.create(owner=self.user)
        TeamFactory.add_projects(team, 2)
        project_name = team.projects[0].name

        result = self.execute("schedule", team=team.name, project=project_name, url="http://www.globo.com", branch="test-branch")
        expect(result).to_be_like(
            "Scheduled a new load test for project '%s' (branch '%s') in team '%s' at '%s' target." % (
                project_name, "test-branch", team.name, self.target
            )
        )

        load_test = LoadTest.objects.filter(team=team, project_name=project_name).first()
        expect(load_test).not_to_be_null()
        expect(load_test.git_branch).to_equal("test-branch")
开发者ID:heynemann,项目名称:wight,代码行数:15,代码来源:test_schedule.py


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