

def test_plans_parser_with_items(self):
    plans_xml = self.load_file('plans_with_items.xml')
    parser = PlansParser()
    expected = [{
        'billing_frequency': 'monthly',
        'billing_frequency_per': 'month',
        'billing_frequency_quantity': 1,
        'billing_frequency_unit': 'months',
        'code': 'FREE_MONTHLY',
        'created_datetime': datetime(2011, 1, 7, 20, 46, 43, tzinfo=tzutc()),
        'description': 'A free monthly plan',
        'id': '6b0d13f4-6bef-102e-b098-40402145ee8b',
        'initial_bill_count': 1,
        'initial_bill_count_unit': 'months',
        'is_active': True,
        'is_free': True,
        'items': [{
            'code': 'MONTHLY_ITEM',
            'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
            'id': 'd19b4970-6e5a-102e-b098-40402145ee8b',
            'is_periodic': False,
            'name': 'Monthly Item',
            'overage_amount': Decimal('0.00'),
            'quantity_included': Decimal('0'),
        }, {
            'code': 'ONCE_ITEM',
            'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
            'id': 'd19ef2f0-6e5a-102e-b098-40402145ee8b',
            'is_periodic': False,
            'name': 'Once Item',
            'overage_amount': Decimal('0.00'),
            'quantity_included': Decimal('0'),
        }],
        'name': 'Free Monthly',
        'recurring_charge_amount': Decimal('0.00'),
        'recurring_charge_code': 'FREE_MONTHLY_RECURRING',
        'setup_charge_amount': Decimal('0.00'),
        'setup_charge_code': '',
        'trial_days': 0,
    }, {
        'billing_frequency': 'monthly',
        'billing_frequency_per': 'month',
        'billing_frequency_quantity': 1,
        'billing_frequency_unit': 'months',
        'code': 'TRACKED_MONTHLY',
        'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
        'description': '',
        'id': 'd19974a6-6e5a-102e-b098-40402145ee8b',
        'initial_bill_count': 1,
        'initial_bill_count_unit': 'months',
        'is_active': True,
        'is_free': False,
        'items': [{
            'code': 'MONTHLY_ITEM',
            'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
            'id': 'd19b4970-6e5a-102e-b098-40402145ee8b',
            'is_periodic': True,
            'name': 'Monthly Item',
            'overage_amount': Decimal('10.00'),
            'quantity_included': Decimal('2'),
        }, {
            'code': 'ONCE_ITEM',
            'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
            'id': 'd19ef2f0-6e5a-102e-b098-40402145ee8b',
            'is_periodic': False,
            'name': 'Once Item',
            'overage_amount': Decimal('10.00'),
            'quantity_included': Decimal('0'),
        }],
        'name': 'Tracked Monthly',
        'recurring_charge_amount': Decimal('10.00'),
        'recurring_charge_code': 'TRACKED_MONTHLY_RECURRING',
        'setup_charge_amount': Decimal('0.00'),
        'setup_charge_code': '',
        'trial_days': 0,
    }, {
        'billing_frequency': 'monthly',
        'billing_frequency_per': 'month',
        'billing_frequency_quantity': 1,
        'billing_frequency_unit': 'months',
        'code': 'PAID_MONTHLY',
        'created_datetime': datetime(2011, 1, 7, 21, 5, 42, tzinfo=tzutc()),
        'description': '',
        'id': '11af9cfc-6bf2-102e-b098-40402145ee8b',
        'initial_bill_count': 1,
        'initial_bill_count_unit': 'months',
        'is_active': True,
        'is_free': False,
        'items': [{
            'code': 'MONTHLY_ITEM',
            'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
            'id': 'd19b4970-6e5a-102e-b098-40402145ee8b',
            'is_periodic': False,
            'name': 'Monthly Item',
            'overage_amount': Decimal('0.00'),
            'quantity_included': Decimal('0'),
        }, {
            'code': 'ONCE_ITEM',
            'created_datetime': datetime(2011, 1, 10, 22, 40, 34, tzinfo=tzutc()),
            'id': 'd19ef2f0-6e5a-102e-b098-40402145ee8b',
            'is_periodic': False,
            'name': 'Once Item',
            'overage_amount': Decimal('0.00'),
            'quantity_included': Decimal('0'),
        }],
        'name': 'Paid Monthly',
        'recurring_charge_amount': Decimal('20.00'),
        'recurring_charge_code': 'PAID_MONTHLY_RECURRING',
        'setup_charge_amount': Decimal('0.00'),
        'setup_charge_code': '',
        'trial_days': 0,
    }]
    result = parser.parse_xml(plans_xml)
    import pprint
    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(result)
    pp.assertEquals(expected, result)

dataset/ETHPy150Open SeanOC/sharpy/tests/parser_tests.py ParserTests.test_plans_parser_with_items/VarMisuse@815/1701 `self`->`pp`