本文整理汇总了Python中eums.services.contact_service.ContactService.get_by_user_id方法的典型用法代码示例。如果您正苦于以下问题:Python ContactService.get_by_user_id方法的具体用法?Python ContactService.get_by_user_id怎么用?Python ContactService.get_by_user_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.services.contact_service.ContactService
的用法示例。
在下文中一共展示了ContactService.get_by_user_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import get_by_user_id [as 别名]
def get(self, request, pk=None):
if pk:
return Response(status=HTTP_200_OK, data=ContactService.get(pk))
created_by_user_id = request.GET.get('createdbyuserid')
if created_by_user_id:
return Response(status=HTTP_200_OK, data=ContactService.get_by_user_id(created_by_user_id))
search_field = request.GET.get('searchfield')
if search_field:
return Response(status=HTTP_200_OK, data=ContactService.search(search_field))
return Response(status=HTTP_200_OK, data=ContactService.get_all())
示例2: test_should_get_contact_by_user_id
# 需要导入模块: from eums.services.contact_service import ContactService [as 别名]
# 或者: from eums.services.contact_service.ContactService import get_by_user_id [as 别名]
def test_should_get_contact_by_user_id(self):
requests.get = MagicMock(return_value=MagicMock(status_code=200, json=MagicMock(return_value=CONTACT)))
response = ContactService.get_by_user_id('17')
self.assertEqual(response, CONTACT)