本文整理匯總了Python中tests.factories.TeamFactory.add_members方法的典型用法代碼示例。如果您正苦於以下問題:Python TeamFactory.add_members方法的具體用法?Python TeamFactory.add_members怎麽用?Python TeamFactory.add_members使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tests.factories.TeamFactory
的用法示例。
在下文中一共展示了TeamFactory.add_members方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [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]
示例2: test_can_create_team_with_members
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [as 別名]
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)
示例3: test_can_create_project_being_a_member
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [as 別名]
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)
示例4: test_get_last_3_load_tests_for_all_projects_when_member
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [as 別名]
def test_get_last_3_load_tests_for_all_projects_when_member(self):
TeamFactory.add_members(self.team, 1)
user = self.team.members[0]
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])
loaded_tests = list(LoadTest.get_by_user(user))
expect(loaded_tests).to_length(6)
示例5: test_can_create_a_load_test_if_team_member
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [as 別名]
def test_can_create_a_load_test_if_team_member(self):
TeamFactory.add_members(self.team, 1)
user = self.team.members[0]
test = LoadTestFactory.create(
created_by=user,
team=self.team,
project_name=self.project.name
)
retrieveds = LoadTest.objects(id=test.id)
expect(retrieveds.count()).to_equal(1)
retrieved = retrieveds.first()
expect(retrieved.status).to_equal("Scheduled")
expect(retrieved.created_by.email).to_equal(user.email)
expect(retrieved.team.name).to_equal(self.team.name)
expect(retrieved.project_name).to_equal(self.project.name)
expect(retrieved.date_created).to_be_like(test.date_created)
expect(retrieved.date_modified).to_be_like(test.date_modified)
示例6: test_to_dict
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [as 別名]
def test_to_dict(self):
team = TeamFactory.create()
TeamFactory.add_members(team, 2)
TeamFactory.add_projects(team, 2)
expect(team.to_dict()).to_be_like({
"name": team.name,
"owner": team.owner.email,
"members": [
team.members[0].email,
team.members[1].email,
],
"projects": [
team.projects[0].to_dict(),
team.projects[1].to_dict(),
]
})
示例7: test_get_return_200_if_not_team_owner_but_team_member
# 需要導入模塊: from tests.factories import TeamFactory [as 別名]
# 或者: from tests.factories.TeamFactory import add_members [as 別名]
def test_get_return_200_if_not_team_owner_but_team_member(self):
TeamFactory.add_members(self.team, 1, with_token=True)
self.user = self.team.members[0]
url = "/teams/%s/projects/%s/load_tests/?quantity=20" % (self.team.name, self.project.name)
response = self.fetch_with_headers(url)
expect(response.code).to_equal(200)