本文整理汇总了Python中eums.services.contact_service.ContactService.add_or_update_rapid_pro_contact方法的典型用法代码示例。如果您正苦于以下问题:Python ContactService.add_or_update_rapid_pro_contact方法的具体用法?Python ContactService.add_or_update_rapid_pro_contact怎么用?Python ContactService.add_or_update_rapid_pro_contact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.services.contact_service.ContactService
的用法示例。
在下文中一共展示了ContactService.add_or_update_rapid_pro_contact方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_add_rapid_pro_contact
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import add_or_update_rapid_pro_contact [as 别名]
def test_should_add_rapid_pro_contact(self):
requests.get = MagicMock()
requests.post = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value=CONTACT)))
ContactService.add_or_update_rapid_pro_contact(CONTACT)
self.assertTrue(requests.post.called)
self.assertFalse(requests.get.called)
示例2: test_should_add_rapid_pro_contact_called
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import add_or_update_rapid_pro_contact [as 别名]
def test_should_add_rapid_pro_contact_called(self, rapid_pro_contact):
rapid_pro_contact.return_value = self.generate_build_rapid_pro_contact(CONTACT)
requests.get = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value={'results': []}
)))
requests.post = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value=CONTACT)))
ContactService.add_or_update_rapid_pro_contact(CONTACT)
self.assertTrue(requests.post.called)
示例3: test_should_update_rapid_pro_contact_when_phone_not_modified
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import add_or_update_rapid_pro_contact [as 别名]
def test_should_update_rapid_pro_contact_when_phone_not_modified(self, rapid_pro_contact):
rapid_pro_contact.return_value = self.generate_build_rapid_pro_contact(CONTACT)
requests.get = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value=self.generate_add_or_update_rapid_pro_contact_response(CONTACT))))
new_contact = copy.deepcopy(CONTACT)
new_contact.update({
'prePhone': CONTACT['phone'],
'phone': CONTACT['phone']
})
requests.post = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value=new_contact)))
ContactService.add_or_update_rapid_pro_contact(new_contact)
self.assertTrue(requests.post.called)
示例4: test_should_update_rapid_pro_contact_when_phone_modified
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import add_or_update_rapid_pro_contact [as 别名]
def test_should_update_rapid_pro_contact_when_phone_modified(self):
requests.get = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value=self.generate_get_rapid_pro_contact_response(CONTACT))))
new_contact = copy.deepcopy(CONTACT)
new_phone = '+8618694029575'
new_contact.update({
'prePhone': CONTACT['phone'],
'phone': new_phone
})
requests.post = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(
return_value=self.generate_add_or_update_rapid_pro_contact_response(CONTACT))))
logger.info(new_contact)
ContactService.add_or_update_rapid_pro_contact(new_contact)
self.assertTrue(requests.post.called)
示例5: test_should_not_add_contact_when_rapid_pro_off
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import add_or_update_rapid_pro_contact [as 别名]
def test_should_not_add_contact_when_rapid_pro_off(self):
requests.post = MagicMock()
ContactService.add_or_update_rapid_pro_contact(CONTACT)
self.assertFalse(requests.post.called)
示例6: execute_one_time_sync
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import add_or_update_rapid_pro_contact [as 别名]
def execute_one_time_sync():
contacts = ContactService.get_all()
for contact in contacts:
ContactService.add_or_update_rapid_pro_contact(contact)