def test_shipping_methods(self):
        adapter = IShoppingSite(self.portal)
        self.assertEqual(len(adapter.shipping_methods()), 0)

        alsoProvides(self.portal, IShoppingSiteRoot)
        container = self.create_content('collective.cart.shipping.ShippingMethodContainer')
        self.create_atcontent('ShippingMethod', container, id='shippingmethod1')
        self.assertEqual(len(adapter.shipping_methods()), 1)
    def shipping_methods(self):
        """Returns list of dictionary of shipping methods

        :rtype: list
        """
        shopping_site = IShoppingSite(self.context)
        default_charset = getattr(getattr(getToolByName(
            self.context, 'portal_properties'), 'site_properties'), 'default_charset', 'utf-8')
        res = []
        for brain in shopping_site.shipping_methods():
            uuid = brain.UID
            orig_uuid = shopping_site.shipping_method()['uuid']

            if uuid == orig_uuid:
                shipping_gross_money = shopping_site.shipping_gross_money()
            else:
                shipping_gross_money = shopping_site.get_shipping_gross_money(uuid)

            if shipping_gross_money.amount == 0.0:
                title = brain.Title
            else:
                title = '{}  {}'.format(brain.Title, shopping_site.format_money(shipping_gross_money).encode(default_charset))

            res.append({
                'description': brain.Description,
                'checked': uuid == orig_uuid,
                'title': title,
                'uuid': uuid,
            })

        return res