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


Python User.last_seen_user_agent方法代码示例

本文整理汇总了Python中intercom.user.User.last_seen_user_agent方法的典型用法代码示例。如果您正苦于以下问题:Python User.last_seen_user_agent方法的具体用法?Python User.last_seen_user_agent怎么用?Python User.last_seen_user_agent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在intercom.user.User的用法示例。


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

示例1: test_properties

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import last_seen_user_agent [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'])
开发者ID:50onRed,项目名称:python-intercom,代码行数:27,代码来源:test_user.py

示例2: test_user_properties

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import last_seen_user_agent [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)
开发者ID:Cloudpapr,项目名称:python-intercom,代码行数:42,代码来源:test_user.py


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