示例#1
0
    def test_item_fees(self):
        item = Item()

        self.assertEqual(item.get_attributes(), None)

        attribute1 = Attribute()
        attribute1.set_id('4321')
        attribute1.set_name('')
        attribute2 = Attribute()
        attribute2.set_id('1234')
        attribute2.set_name('')

        item.set_attributes([attribute1, attribute2])

        self.assertEqual(len(item.get_attributes()), 2)

        item.delete_attribute_by_id('1234')

        self.assertEqual(len(item.get_attributes()), 1)

        item.set_attributes([attribute1, attribute2])
        item.delete_attribute(0)

        self.assertEqual(item.get_attributes()[0].get_id(), '1234')

        item.clear_attributes()

        self.assertEqual(item.get_attributes(), None)
示例#2
0
print '[test] get_event_item'
response = constantcontact.get_event_item(event_response, item_response)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

item_response.set_price(3)

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

attr = Attribute()
attr.set_name('Bewitching')
attr.set_quantity_total(10)

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

print '[test] get_event_item_attrbutes'
response = constantcontact.get_event_item_attributes(event_response, item_response)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')
    def test_item_fees(self):
        item = Item()

        self.assertEqual(item.get_attributes(), None)

        attribute1 = Attribute()
        attribute1.set_id('4321')
        attribute1.set_name('')
        attribute2 = Attribute()
        attribute2.set_id('1234')
        attribute2.set_name('')

        item.set_attributes([attribute1, attribute2])

        self.assertEqual(len(item.get_attributes()), 2)

        item.delete_attribute_by_id('1234')

        self.assertEqual(len(item.get_attributes()), 1)

        item.set_attributes([attribute1, attribute2])
        item.delete_attribute(0)

        self.assertEqual(item.get_attributes()[0].get_id(), '1234')

        item.clear_attributes()

        self.assertEqual(item.get_attributes(), None)