def testSetLineItemCustomFieldValue(self):
     """Test whether we can set a value to a custom field on line item."""
     test_string_custom_field_id = util.CreateTestLineItemCustomField(
         client, SERVER_V201206, VERSION_V201206, 'STRING')
     test_drop_down_custom_field_id = util.CreateTestLineItemCustomField(
         client, SERVER_V201206, VERSION_V201206, 'DROP_DOWN')
     drop_down_custom_field_option_id = util.CreateTestLineItemCustomFieldOption(
         client, SERVER_V201206, VERSION_V201206,
         test_drop_down_custom_field_id)
     set_line_item_custom_field_value.main(
         client, test_string_custom_field_id,
         test_drop_down_custom_field_id, drop_down_custom_field_option_id,
         self.__class__.test_line_item_id)
    def setUp(self):
        """Prepare unittest."""
        if not self.__class__.loaded:
            advertiser_id = util.CreateTestAdvertiser(client, SERVER_V201206,
                                                      VERSION_V201206)
            trafficker_id = util.GetTrafficker(client, SERVER_V201206,
                                               VERSION_V201206)
            order_id = util.CreateTestOrder(client, SERVER_V201206,
                                            VERSION_V201206, advertiser_id,
                                            trafficker_id)
            ad_unit_id = util.CreateTestAdUnit(client, SERVER_V201206,
                                               VERSION_V201206)
            placement_id = util.CreateTestPlacement(client, SERVER_V201206,
                                                    VERSION_V201206,
                                                    [ad_unit_id])
            self.__class__.test_line_item_id = util.CreateTestLineItem(
                client, SERVER_V201206, VERSION_V201206, order_id,
                [placement_id])

            self.__class__.test_drop_down_custom_field_id = (
                util.CreateTestLineItemCustomField(client, SERVER_V201206,
                                                   VERSION_V201206,
                                                   'DROP_DOWN'))

            self.__class__.loaded = True