本文整理汇总了Python中osf_tests.factories.UserFactory.given_name方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.given_name方法的具体用法?Python UserFactory.given_name怎么用?Python UserFactory.given_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osf_tests.factories.UserFactory
的用法示例。
在下文中一共展示了UserFactory.given_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_users_list_filter_multiple_field
# 需要导入模块: from osf_tests.factories import UserFactory [as 别名]
# 或者: from osf_tests.factories.UserFactory import given_name [as 别名]
def test_users_list_filter_multiple_field(self, app, user_one, user_two):
john_doe = UserFactory(fullname='John Doe')
john_doe.given_name = 'John'
john_doe.family_name = 'Doe'
john_doe.save()
doe_jane = UserFactory(fullname='Doe Jane')
doe_jane.given_name = 'Doe'
doe_jane.family_name = 'Jane'
doe_jane.save()
url = '/{}users/?filter[given_name,family_name]=Doe'.format(API_BASE)
res = app.get(url)
data = res.json['data']
assert len(data) == 2
示例2: test_citation_with_only_fullname
# 需要导入模块: from osf_tests.factories import UserFactory [as 别名]
# 或者: from osf_tests.factories.UserFactory import given_name [as 别名]
def test_citation_with_only_fullname(self):
user = UserFactory()
user.fullname = 'Martin Luther King, Jr.'
user.family_name = ''
user.given_name = ''
user.middle_names = ''
user.suffix = ''
user.save()
resp = user.csl_name()
family_name = resp['family']
given_name = resp['given']
assert_equal(family_name, 'King')
assert_equal(given_name, 'Martin L, Jr.')