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


Python User.companies方法代码示例

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


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

示例1: test_user_companies

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import companies [as 别名]
def test_user_companies():
    user = User()
    user.companies = [{
        'id': 1,
        'name': 'Intercom',
        'created_at': datetime.fromtimestamp(1331764344)}]
    raises(AttributeError, lambda: user.companies)
    user.companies = {'foo': 'bar'}
开发者ID:Cloudpapr,项目名称:python-intercom,代码行数:10,代码来源:test_user.py

示例2: test_companies

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import companies [as 别名]
 def test_companies(self):
     user = User()
     user.companies = [{
         'id': 1,
         'name':' Intercom',
         'created_at': datetime.fromtimestamp(1331764344)}]
     self.assertRaises(AttributeError, lambda: user.companies)
     try:
         user.companies = {'foo':'bar'}
         self.fail()
     except ValueError:
         pass
开发者ID:uservidya,项目名称:python-intercom,代码行数:14,代码来源:test_user.py

示例3: test_properties

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import companies [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' }
        user.companies = [{
            'id':1,
            'name':'Intercom'}]
        with self.assertRaises(AttributeError):
            # cannot set the relationship score
            user.relationship_score = 50

        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)
        with self.assertRaises(AttributeError):
            # cannot read the companies
            user.companies
        self.assertEqual(None, user.relationship_score)
        self.assertEqual(1331764344,
                time.mktime(user.created_at.timetuple()))
        self.assertEqual('Ace', user.custom_data['name'])
开发者ID:cameronmaske,项目名称:python-intercom,代码行数:30,代码来源:test_user.py

示例4: it_allows_easy_setting_of_multiple_companies

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import companies [as 别名]
 def it_allows_easy_setting_of_multiple_companies(self):
     user = User()
     companies = [
         {"name": "Intercom", "company_id": "6"},
         {"name": "Test", "company_id": "9"},
     ]
     user.companies = companies
     eq_(user.to_dict()["companies"], companies)
开发者ID:jkeyes,项目名称:python-intercom,代码行数:10,代码来源:test_user.py

示例5: test_user_properties

# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import companies [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.companies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。