本文整理汇总了Python中contact.Contact.retrieve方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.retrieve方法的具体用法?Python Contact.retrieve怎么用?Python Contact.retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contact.Contact
的用法示例。
在下文中一共展示了Contact.retrieve方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDeleteContactById
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def testDeleteContactById(self):
contactId = 1
#check if contact #1 exist
contact = Contact.retrieve(contactId)
self.failUnless(contact)
#delete contact #1
successful = contact.delete()
self.failUnless(successful)
#confirm contact #1 no longer exist
contact = Contact.retrieve(contactId)
self.failIf( contact )
示例2: testEditContactPhone
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def testEditContactPhone(self):
contactId = 1
oldPhone, newPhone = '02099888999', '02011222111'
#check confirm contact's old phone
contact = Contact.retrieve(contactId)
self.assertEquals(contact.phone, oldPhone)
self.assertNotEquals(contact.phone, newPhone)
#update contact's phone
contact.phone = newPhone
successful = contact.update()
self.failUnless(successful)
#confirm contact's new name after update
contact = Contact.retrieve(contactId)
self.assertEquals(contact.phone, newPhone)
self.assertNotEquals(contact.phone, oldPhone)
示例3: testEditContactName
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def testEditContactName(self):
contactId = 1
oldName, newName = 'Lennox', 'Leonard'
#check confirm contact's old name
contact = Contact.retrieve(contactId)
self.assertEquals(contact.name, oldName)
self.assertNotEquals(contact.name, newName)
#update contact's name
contact.name = newName
successful = contact.update()
self.failUnless(successful)
#confirm contact's new name after update
contact = Contact.retrieve(contactId)
self.assertEquals(contact.name, newName)
self.assertNotEquals(contact.name, oldName)
示例4: deleteContactPrompt
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def deleteContactPrompt(self):
deleter = DeleteContactPrompt(self.prompt)
id = deleter.readContactIdForDeletion()
contact = Contact.retrieve(id)
if contact:
if contact.delete() :
print '{} DELETED'.format(contact)
else:
print 'Contact #{} does not exist'.format(id)
self.deleteContactPrompt()
示例5: showContactPrompt
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def showContactPrompt(self):
shower = ShowContactPrompt(self.prompt)
id = shower.readContactIdToShow()
if id == -1:
contacts = Contact.retrieveAll()
shower.showAll(contacts)
return
contact = Contact.retrieve(id)
if contact:
shower.show(contact)
else:
print 'Contact #{} does not exist'.format(id)
shower.readContactIdToShow()
示例6: editContactPrompt
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def editContactPrompt(self):
editor = EditContactPrompt(self.prompt)
id = editor.readContactId()
contact = Contact.retrieve(id)
if contact:
contact.name = editor.readEdittedName(contact.name)
contact.phone = editor.readEdittedPhone(contact.phone)
contact.gender = editor.readEdittedGender(contact.gender)
contact.description = editor.readEdittedDescription(contact.description)
contact.update()
print '{} UPDATED\n'.format(contact)
else:
print 'Contact #{} does not exist'.format(id)
self.editContactPrompt()
示例7: testRetrieveContactById
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import retrieve [as 别名]
def testRetrieveContactById(self):
contactId = 1
#check if contact #1 exist
contact = Contact.retrieve(contactId)
self.failUnless(contact)
self.assertEqual(contactId, contact.id)