Пример #1
0
    def test_accinf_init_from_dict(self):
        account_info = Account_Info({
            'first_name': 'Bob',
            'organization_name': 'League of super evil'
        })

        self.assertEqual(account_info.get_first_name(), 'Bob')
        self.assertEqual(account_info.get_organization_name(),
                         'League of super evil')
Пример #2
0
    def test_accinf_org_address(self):
        account_info = Account_Info()
        address = Address()
        address.set_line1('Mt. Doom')

        self.assertEqual(account_info.get_organization_address(), None)

        account_info.set_organization_address(address)

        self.assertEqual(account_info.get_organization_address(), address)

        account_info.clear_organization_address()

        self.assertEqual(account_info.get_organization_address(), None)
Пример #3
0
    def test_accinf_org_address(self):
        account_info = Account_Info()
        address = Address()
        address.set_line1('Mt. Doom')

        self.assertEqual(account_info.get_organization_address(), None)

        account_info.set_organization_address(address)

        self.assertEqual(account_info.get_organization_address(), address)

        account_info.clear_organization_address()

        self.assertEqual(account_info.get_organization_address(), None)
Пример #4
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)
Пример #5
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)
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)

print '[test] get_account_info'
response = constantcontact.get_account_info()
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

print '[test] put_account_info'
account_info = Account_Info()
account_info.set_phone('1234567890')
account_info.set_state_code('MA')

response = constantcontact.update_account_info(account_info)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

print '[test] get_verified_email_addresses'
response = constantcontact.get_verified_email_addresses()
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

print '[test] post_verified_email_addresses'
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)

print '[test] get_account_info'
response = constantcontact.get_account_info()
if printout and response:
    print json.dumps(response, indent=4, sort_keys=True)
    raw_input('press enter for next test')

print '[test] put_account_info'
account_info = Account_Info()
account_info.set_phone('1234567890')
account_info.set_state_code('MA')

response = constantcontact.update_account_info(account_info)
if printout and response:
    print json.dumps(response, indent=4, sort_keys=True)
    raw_input('press enter for next test')

print '[test] get_verified_email_addresses'
response = constantcontact.get_verified_email_addresses()
if printout and response:
    print json.dumps(response, indent=4, sort_keys=True)
    raw_input('press enter for next test')

print '[test] post_verified_email_addresses'
Пример #8
0
    def test_accinf_setter_getter(self):
        account_info = Account_Info()
        account_info.set_email('*****@*****.**')
        account_info.set_website('example.com')

        self.assertEqual(account_info.get_last_name(), None)
        self.assertEqual(account_info.get_email(), '*****@*****.**')
        self.assertEqual(account_info.get_website(), 'example.com')

        account_info.delete_website()

        self.assertEqual(account_info.get_website(), None)
Пример #9
0
 def test_accinf_init_from_dict(self):
     account_info = Account_Info({'first_name': 'Bob', 'organization_name': 'League of super evil'})
     
     self.assertEqual(account_info.get_first_name(), 'Bob')
     self.assertEqual(account_info.get_organization_name(), 'League of super evil')
Пример #10
0
    def test_accinf_setter_getter(self):
        account_info = Account_Info()
        account_info.set_email('*****@*****.**')
        account_info.set_website('example.com')

        self.assertEqual(account_info.get_last_name(), None)
        self.assertEqual(account_info.get_email(), '*****@*****.**')
        self.assertEqual(account_info.get_website(), 'example.com')

        account_info.delete_website()

        self.assertEqual(account_info.get_website(), None)