Exemplo n.º 1
0
    def test_event_contact(self):
        event = Event()

        contact = Contact()

        contact.set_prefix_name('Prof.')
        contact.set_last_name('Oak')

        event.set_contact(contact)

        self.assertEqual(event.get_contact()['name'], 'Prof. Oak')

        account_info = Account_Info()

        account_info.set_first_name('Gary')
        account_info.set_last_name('Oak')

        event.set_contact(account_info)

        self.assertEqual(event.get_contact()['name'], 'Gary Oak')

        event.delete_contact()

        self.assertEqual(event.get_contact(), None)
Exemplo n.º 2
0
    def test_event_contact(self):
        event = Event()

        contact = Contact()

        contact.set_prefix_name("Prof.")
        contact.set_last_name("Oak")

        event.set_contact(contact)

        self.assertEqual(event.get_contact()["name"], "Prof. Oak")

        account_info = Account_Info()

        account_info.set_first_name("Gary")
        account_info.set_last_name("Oak")

        event.set_contact(account_info)

        self.assertEqual(event.get_contact()["name"], "Gary Oak")

        event.delete_contact()

        self.assertEqual(event.get_contact(), None)
Exemplo n.º 3
0
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)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

event_response = response
print event_response.get_id()

print '[test] get_event'