예제 #1
0
 def test_delete_contact_tags(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     success = contact.delete_tags([{'name': 'Possible Client'}])
     self.assertEqual(success, True)
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(len(contact.tags), 1)
     self.assertEqual(contact.tags[0].name, "Old Contact List")
     self.assertEqual(contact.tags[0].score, 3)
     self.assertEqual(
         contact.tags[0].id,
         "elZDN1dSa3ZmSDJ1MjNrRVBabDhoNmdKbmthUmY1YTVOYkx5TmhwYVZfSTE1")
 def test_start_contact_campaigns(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     success = contact.start_campaigns([{'name': 'Trial Request Followup'}])
     self.assertEqual(success, True)
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.campaigns[0].name,
                      "Brochure Request Followup")
     self.assertEqual(contact.campaigns[0].step, 0)
     self.assertEqual(contact.campaigns[0].id, "958650")
     self.assertEqual(contact.campaigns[1].name, "Trial Request Followup")
     self.assertEqual(contact.campaigns[1].step, 0)
     self.assertEqual(contact.campaigns[1].id, "958651")
 def test_search_by_name_with_results(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contacts = hatchbuck.search_contacts(firstName="Jack",
                                          lastName="Spratt")
     self.assertEqual(len(contacts), 1)
     self.assertEqual(contacts[0].firstName, "Jack")
     self.assertEqual(contacts[0].lastName, "Spratt")
 def test_search_contact_with_customFields(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact = hatchbuck.search_contacts(contactId=CONTACT_ID)[0]
     self.assertEqual(contact.contactId, CONTACT_ID)
     customFields = contact.customFields
     self.assertEqual(len(customFields), 2)
     self.assertEqual(customFields[0].name, "Company Size")
     self.assertEqual(customFields[0].value, "42")
 def test_search_by_contact_id_with_results(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "NlNfOTJrVFFtd0E4NVhXWGdmSy0ySVdBSHhpZ01hS1NCSFFxMVBTTmlKVTE1"
     contacts = hatchbuck.search_contacts(contactId=contact_id)
     self.assertEqual(len(contacts), 1)
     self.assertEqual(contacts[0].contactId, contact_id)
     self.assertEqual(contacts[0].firstName, "Jack")
     self.assertEqual(contacts[0].lastName, "Spratt")
 def test_stop_contact_campaigns(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     success = contact.stop_campaigns([{
         'name': 'Brochure Request Followup'
     }])
     self.assertEqual(success, True)
예제 #7
0
 def test_add_contact_tags(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     success = contact.add_tags([{'name': 'Old Contact List'}])
     self.assertEqual(success, True)
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.tags[0].name, "Possible Client")
     self.assertEqual(contact.tags[0].score, 1)
     self.assertEqual(
         contact.tags[0].id,
         "WjFmbDktWGpDVV9OMEtHdjY0Mm83ZVJUT0w5UDVKRTNmN0NRcXdrSGhMMDE1")
     self.assertEqual(contact.tags[1].name, "Old Contact List")
     self.assertEqual(contact.tags[1].score, 3)
     self.assertEqual(
         contact.tags[1].id,
         "elZDN1dSa3ZmSDJ1MjNrRVBabDhoNmdKbmthUmY1YTVOYkx5TmhwYVZfSTE1")
예제 #8
0
 def test_update_contact_temperature(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "TWlQd3RkSUNKc2h5dXg3UWtFbkZGZE1QZ3R4d0tUM3N0TjI0bDRUMS03MDE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.temperature.name, "Hot")
     contact.set_temperature(
         id="M2tyTXVQUmg1NUdKUDViWjkwOFUzQWtPSW9pZzV2STZkS29DeEdDS1ZlSTE1")
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.temperature.name, "On Fire")
 def test_get_contact_campaigns(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     campaigns = contact.get_campaigns()
     self.assertEqual(campaigns[0].name, "Brochure Request Followup")
     self.assertEqual(campaigns[0].step, 0)
     self.assertEqual(
         campaigns[0].id,
         "b1BFUnM1Unh0MDVVOVJEWUc1d0pTM0pUSVY4QS0xOW5GRHRsS05DXzNXazE1")
예제 #10
0
 def test_update_basic_contact(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     contact.firstName = "Jill"
     contact.lastName = "Smith"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.firstName, "Jill")
     self.assertEqual(contact.lastName, "Smith")
예제 #11
0
 def test_get_contact_tags(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.contactId, contact_id)
     tags = contact.get_tags()
     self.assertEqual(tags[0].name, "Possible Client")
     self.assertEqual(tags[0].score, 1)
     self.assertEqual(
         tags[0].id,
         "WjFmbDktWGpDVV9OMEtHdjY0Mm83ZVJUT0w5UDVKRTNmN0NRcXdrSGhMMDE1")
 def test_search_by_email_with_results(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contacts = hatchbuck.search_contacts(emails=["*****@*****.**"])
     self.assertEqual(len(contacts), 1)
     self.assertEqual(contacts[0].firstName, "Jack")
     self.assertEqual(contacts[0].lastName, "Spratt")
     self.assertEqual(contacts[0].salesRep.username, "jakesen")
     self.assertEqual(contacts[0].status.name, "Lead")
     self.assertEqual(contacts[0].emails[0].address, "*****@*****.**")
     self.assertEqual(contacts[0].emails[0].type, "Work")
     self.assertEqual(contacts[0].subscribed, True)
     self.assertEqual(contacts[0].timezone, "Central Standard Time")
예제 #13
0
 def test_delete_contact_tags_by_email(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_email = "*****@*****.**"
     success = hatchbuck.delete_tags(contact_email, [{
         'id':
         'elZDN1dSa3ZmSDJ1MjNrRVBabDhoNmdKbmthUmY1YTVOYkx5TmhwYVZfSTE1'
     }])
     self.assertEqual(success, True)
     contact = hatchbuck.search_contacts(emails=[contact_email])[0]
     self.assertEqual(len(contact.tags), 1)
     self.assertEqual(contact.tags[0].name, "Possible Client")
     self.assertEqual(contact.tags[0].score, 1)
     self.assertEqual(
         contact.tags[0].id,
         "WjFmbDktWGpDVV9OMEtHdjY0Mm83ZVJUT0w5UDVKRTNmN0NRcXdrSGhMMDE1")
예제 #14
0
 def test_update_contact_address(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "TWlQd3RkSUNKc2h5dXg3UWtFbkZGZE1QZ3R4d0tUM3N0TjI0bDRUMS03MDE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.addresses[0].street, "123 Main Street")
     self.assertEqual(
         contact.addresses[0].id,
         "YlFxUEZPR3M5MGVDSW9XXzhEMDhqVmNVdzVHTUU3U2duT21lYk9tMnU1YzE1")
     contact.addresses[0].street = "555 Commerce Ave"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.addresses[0].street, "555 Commerce Ave")
     self.assertEqual(
         contact.addresses[0].id,
         "YlFxUEZPR3M5MGVDSW9XXzhEMDhqVmNVdzVHTUU3U2duT21lYk9tMnU1YzE1")
예제 #15
0
 def test_update_contact_phone(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "TWlQd3RkSUNKc2h5dXg3UWtFbkZGZE1QZ3R4d0tUM3N0TjI0bDRUMS03MDE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.phones[0].number, "555-555-5555")
     self.assertEqual(
         contact.phones[0].id,
         "YzNZTGhZRjdadlNRMzl6Qlo1YkY3X1JmX09DNHp0RDZJT1lrMGl6NjJETTE1")
     contact.phones[0].number = "555-555-1234"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.phones[0].number, "555-555-1234")
     self.assertEqual(
         contact.phones[0].id,
         "YzNZTGhZRjdadlNRMzl6Qlo1YkY3X1JmX09DNHp0RDZJT1lrMGl6NjJETTE1")
예제 #16
0
 def test_update_contact_social_networks(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "TWlQd3RkSUNKc2h5dXg3UWtFbkZGZE1QZ3R4d0tUM3N0TjI0bDRUMS03MDE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.socialNetworks[0].address, "@pyhatchbuck")
     self.assertEqual(
         contact.socialNetworks[0].id,
         "dGNZT0xWVVJSQlBKOWxLdnBlZS01MWdUQkxadk1XM2p1cG8yRWFhNjAyWTE1")
     contact.socialNetworks[0].address = "@alex.smith.pyhatchbuck"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.socialNetworks[0].address,
                      "@alex.smith.pyhatchbuck")
     self.assertEqual(
         contact.socialNetworks[0].id,
         "dGNZT0xWVVJSQlBKOWxLdnBlZS01MWdUQkxadk1XM2p1cG8yRWFhNjAyWTE1")
예제 #17
0
 def test_update_contact_website(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "TWlQd3RkSUNKc2h5dXg3UWtFbkZGZE1QZ3R4d0tUM3N0TjI0bDRUMS03MDE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.website[0].websiteUrl, "www.pyhatchbuck.net")
     self.assertEqual(
         contact.website[0].id,
         "VC1Hcl9yeXVucjFDdVViRkY4RXA2UzNkcnVBeFQtSEhmUkdIWEZPdnp5STE1")
     contact.website[0].websiteUrl = "www.pyhatchbuck-rocks.net"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.website[0].websiteUrl,
                      "www.pyhatchbuck-rocks.net")
     self.assertEqual(
         contact.website[0].id,
         "VC1Hcl9yeXVucjFDdVViRkY4RXA2UzNkcnVBeFQtSEhmUkdIWEZPdnp5STE1")
예제 #18
0
 def test_update_contact_email(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "d1F4Tm1tcUxVRmdFQmVIT3lhVjNpaUtxamprakk5S3JIUGRmVWtHUXJaRTE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.emails[0].address, "*****@*****.**")
     self.assertEqual(
         contact.emails[0].id,
         "SXU4LVZRWkFzM3UtMnZ4UGtrRTJtMmgyQWV2dnpUV19tNjFBaVFqRnk2QTE1")
     contact.emails[0].address = "*****@*****.**"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.emails[0].address,
                      "*****@*****.**")
     self.assertEqual(
         contact.emails[0].id,
         "SXU4LVZRWkFzM3UtMnZ4UGtrRTJtMmgyQWV2dnpUV19tNjFBaVFqRnk2QTE1")
예제 #19
0
 def test_update_contact_instant_messages(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact_id = "TWlQd3RkSUNKc2h5dXg3UWtFbkZGZE1QZ3R4d0tUM3N0TjI0bDRUMS03MDE1"
     contact = hatchbuck.search_contacts(contactId=contact_id)[0]
     self.assertEqual(contact.instantMessaging[0].address,
                      "alex.pyhatchbuck")
     self.assertEqual(
         contact.instantMessaging[0].id,
         "OWdYcHkzcVBwRE4zZEtzTEhJbFc4SVpLTm91WjJWd2tQUWxXcm9TdjdHazE1")
     contact.instantMessaging[0].address = "as.pyhatchbuck"
     success = contact.save()
     self.assertEqual(success, True)
     self.assertEqual(contact.instantMessaging[0].address, "as.pyhatchbuck")
     self.assertEqual(
         contact.instantMessaging[0].id,
         "OWdYcHkzcVBwRE4zZEtzTEhJbFc4SVpLTm91WjJWd2tQUWxXcm9TdjdHazE1")
 def test_search_contact_without_customFields(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contact = hatchbuck.search_contacts(contactId=CONTACT_ID)[0]
     self.assertEqual(contact.contactId, CONTACT_ID)
     customFields = contact.customFields
     self.assertEqual(len(customFields), 0)
 def test_search_by_email_with_no_results(self):
     hatchbuck = HatchbuckAPI(self.test_api_key)
     contacts = hatchbuck.search_contacts(emails=["*****@*****.**"])
     self.assertEqual(contacts, None)