def test_cont_lists(self):
        contact = Contact()

        lists = [{'id': '123'}, {'id': '456'}, {'id': '789'}]
        contact_list = Contact_List({'id': '321'})

        contact.set_lists(lists)

        self.assertEqual(len(contact.get_lists()), 3)
        self.assertEqual(contact.get_list(2).get_id(), '789')

        contact.add_list(contact_list)
        contact.add_list_id('654')
        contact.remove_list_id('123')
        contact.remove_list(1)

        self.assertEqual(contact.get_list(0).get_id(), '456')
        self.assertEqual(contact.get_list(2).get_id(), '654')
        self.assertEqual(len(contact.get_lists()), 3)

        contact.remove_all_lists()

        self.assertEqual(contact.get_lists(), None)
    def test_cont_lists(self):
        contact = Contact()

        lists = [{"id": "123"}, {"id": "456"}, {"id": "789"}]
        contact_list = Contact_List({"id": "321"})

        contact.set_lists(lists)

        self.assertEqual(len(contact.get_lists()), 3)
        self.assertEqual(contact.get_list(2).get_id(), "789")

        contact.add_list(contact_list)
        contact.add_list_id("654")
        contact.remove_list_id("123")
        contact.remove_list(1)

        self.assertEqual(contact.get_list(0).get_id(), "456")
        self.assertEqual(contact.get_list(2).get_id(), "654")
        self.assertEqual(len(contact.get_lists()), 3)

        contact.remove_all_lists()

        self.assertEqual(contact.get_lists(), None)
示例#3
0
    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'
response =  constantcontact.get_contact_tracking_summary(contact_id)
if printout and response: