本文整理汇总了Python中profiles.factories.ProfileFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python ProfileFactory.create_batch方法的具体用法?Python ProfileFactory.create_batch怎么用?Python ProfileFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profiles.factories.ProfileFactory
的用法示例。
在下文中一共展示了ProfileFactory.create_batch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_view_with_search
# 需要导入模块: from profiles.factories import ProfileFactory [as 别名]
# 或者: from profiles.factories.ProfileFactory import create_batch [as 别名]
def test_view_with_search(self, staff_client, program_data):
"""
Tests that ReviewFinancialAidView returns the expected results with search
"""
fin_aid_status = FinancialAidStatus.AUTO_APPROVED
profiles = ProfileFactory.create_batch(
4,
first_name=factory.Iterator(['match_name', 'x', 'y', 'z']),
last_name=factory.Iterator(['x', 'y', 'z', 'match_name']),
)
FinancialAidFactory.create_batch(
4,
tier_program=program_data.tier_programs["0k"],
status=fin_aid_status,
user=factory.Iterator([p.user for p in profiles])
)
name_query = 'match_name'
url = self.review_url(program_data.program.id, status=fin_aid_status, search_param=name_query)
resp = staff_client.get(url)
assert resp.status_code == status.HTTP_200_OK
financial_aid_objects = resp.context_data["financial_aid_objects"]
# Two users should match the search term - one for first_name, one for last_name
assert len(financial_aid_objects) == 2
assert all(
fin_aid.user.profile.first_name == name_query or fin_aid.user.profile.last_name == name_query
for fin_aid in financial_aid_objects
)