def test_promo_init_from_dict(self):
        promocode = Promocode({'id': '123456', 'code_name': 'Name Goes Here!'})

        self.assertEqual(promocode.get_code_name(), 'Name Goes Here!')
Exemple #2
0
fee_response.set_fee(5)

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

print '[test] delete_event_fee'
response = constantcontact.delete_event_fee(event_response, fee_response)
if printout and response:
    print response
    raw_input('press enter for next test')

pc = Promocode()

pc.set_code_name('Test_Code')
pc.set_code_type('DISCOUNT')
pc.set_discount_percent(10)
pc.set_discount_scope('ORDER_TOTAL')
pc.set_is_paused(False)
pc.set_quantity_total(-1)

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

print '[test] get_event_promocodes'
    def test_promo_fee_ids(self):
        promocode = Promocode()

        self.assertEqual(promocode.get_fee_ids(), None)

        fee_ids = ['123', '456', '789', 'abc']

        promocode.set_fee_ids(fee_ids)

        self.assertEqual(len(promocode.get_fee_ids()), 4)

        promocode.delete_fee_by_id('789')

        self.assertFalse('789' in promocode.get_fee_ids())

        promocode.delete_fee(2)

        self.assertFalse('abc' in promocode.get_fee_ids())

        promocode.clear_fee_ids()

        self.assertFalse(promocode.get_fee_ids(), None)