本文整理汇总了Python中intercom.user.User.name方法的典型用法代码示例。如果您正苦于以下问题:Python User.name方法的具体用法?Python User.name怎么用?Python User.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intercom.user.User
的用法示例。
在下文中一共展示了User.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_properties
# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import name [as 别名]
def test_properties(self):
user = User()
user.email = '[email protected]'
user.user_id = 1234
user.name = 'Joe'
user.last_seen_ip = '192.168.1.100'
user.last_seen_user_agent = 'Mozilla/5.0'
user.created_at = datetime.fromtimestamp(1331764344)
user.custom_data = { 'name': 'Ace' }
try:
# cannot set the relationship score
user.relationship_score = 50
except AttributeError:
pass
self.assertEqual('[email protected]', user.email)
self.assertEqual(1234, user.user_id)
self.assertEqual('Joe', user.name)
self.assertEqual('192.168.1.100', user.last_seen_ip)
self.assertEqual('Mozilla/5.0', user.last_seen_user_agent)
self.assertEqual(None, user.relationship_score)
self.assertEqual(1331764344,
time.mktime(user.created_at.timetuple()))
self.assertEqual('Ace', user.custom_data['name'])
示例2: test_user_properties
# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import name [as 别名]
def test_user_properties():
created_at = datetime.fromtimestamp(1331764344)
last_request_at = datetime.fromtimestamp(1331764345)
last_impression_at = datetime.fromtimestamp(1331764346)
user = User()
user.email = '[email protected]'
user.user_id = 1234
user.name = 'Somebody'
user.last_seen_ip = '192.168.1.100'
user.last_seen_user_agent = 'Mozilla/5.0'
user.last_request_at = last_request_at
user.last_impression_at = last_impression_at
user.created_at = created_at
user.unsubscribed_from_emails = True
user.custom_data = {'name': 'Ace'}
user.companies = [{
'id': 1,
'name': 'Intercom',
'created_at': created_at}]
try:
# cannot set the relationship score
user.relationship_score = 50
raise AttributeError
except AttributeError:
pass
eq_(user.email, '[email protected]')
eq_(user.user_id, 1234)
eq_(user.name, 'Somebody')
eq_(user.last_seen_ip, '192.168.1.100')
eq_(user.last_seen_user_agent, 'Mozilla/5.0')
eq_(user.last_request_at, last_request_at)
eq_(user.last_impression_at, last_impression_at)
eq_(user.relationship_score, None)
eq_(user.created_at, created_at)
eq_(user.unsubscribed_from_emails, True)
eq_(user.custom_data['name'], 'Ace')
eq_(user.session_count, 0)
raises(AttributeError, lambda: user.companies)