def test_cont_setter_getter(self): contact = Contact() contact.set_first_name('Mabel') contact.set_last_name('Pines') contact.set_company_name('The Mystery hack') self.assertEqual(contact.get_job_title(), None) self.assertEqual(contact.get_first_name(), 'Mabel') self.assertEqual(contact.get_last_name(), 'Pines') contact.delete_last_name() self.assertEqual(contact.get_last_name(), None)
def test_cont_setter_getter(self): contact = Contact() contact.set_first_name("Mabel") contact.set_last_name("Pines") contact.set_company_name("The Mystery hack") self.assertEqual(contact.get_job_title(), None) self.assertEqual(contact.get_first_name(), "Mabel") self.assertEqual(contact.get_last_name(), "Pines") contact.delete_last_name() self.assertEqual(contact.get_last_name(), None)
response = constantcontact.get_contacts(email = test_email) if printout and response: print json.dumps(response, indent = 4, sort_keys = True) raw_input('press enter for next test') contact = response['results'][0] contact_id = contact.get_id() print '[test] get_contact' response = constantcontact.get_contact(contact_id) if printout and response: print json.dumps(response, indent = 4, sort_keys = True) raw_input('press enter for next test') print '[test] update_contact' new_contact = Contact() new_contact.set_first_name('updated contact name 2') new_contact.set_email_address(test_email) new_contact.set_lists(contact.get_lists()) new_contact.set_id(contact.get_id()) response = constantcontact.update_contact(new_contact) if printout and response: print json.dumps(response, indent = 4, sort_keys = True) raw_input('press enter for next test') print '[test] get_contact_tracking' response = constantcontact.get_contact_tracking(contact_id) if printout and response: print json.dumps(response, indent = 4, sort_keys = True) raw_input('press enter for next test') print '[test] get_contact_tracking_summary'
constantcontact = ConstantContact(api_key, access_token, api_url) print '[test] get_events' response = constantcontact.get_events(limit = 3) if printout and response: print json.dumps(response, indent = 4, sort_keys = True) raw_input('press enter for next test') start_date = (datetime.now() + timedelta(hours=6)).replace(minute=0) end_date = (datetime.now() + timedelta(days=5)).replace(minute=0) verified_email_address = constantcontact.get_verified_email_addresses('CONFIRMED')[0]['email_address'] contact = Contact() contact.set_email_address(verified_email_address) contact.set_first_name('Bob') contact.set_company_name('Justice League') contact.set_work_phone('8675309') event = Event() event.set_end_date(end_date.isoformat()) event.set_name('Test event '+str(randint(1000000, 9999999))) event.set_title('please ignore') event.set_contact(contact) event.set_location('THE SECRET MOONBASE') event.set_time_zone_id('US/Eastern') event.set_type('OTHER') event.set_start_date(start_date.isoformat()) print '[test] post_events' response = constantcontact.post_events(event)
import json from random import randint printout = True creds_file = open('creds.txt', 'r') access_token = creds_file.readline().replace('\n', '') api_key = creds_file.readline().replace('\n', '') api_url = creds_file.readline().replace('\n', '') constantcontact = ConstantContact(api_key, access_token, api_url) contact1 = Contact() contact1.set_email_address('*****@*****.**') contact1.set_first_name('Albus') contact2 = Contact() contact2.set_email_address('*****@*****.**') contact2.set_first_name('Severus') import_data = [] import_data.append(contact1) import_data.append(contact2) contact_lists = constantcontact.get_lists() for l in contact_lists: if l.get_name().lower() == 'general interest': general_interest = [l.get_id()] elif l.get_name().lower() == 'test list 1':