コード例 #1
0
    def test_get_article(self):
        order = self.create_content('collective.cart.core.Order', id='1')
        adapter = IOrderAdapter(order)
        self.assertIsNone(adapter.get_article('1'))

        article1 = self.create_content('collective.cart.core.OrderArticle', order, id='1')
        self.assertIsNone(adapter.get_article('2'))
        self.assertEqual(adapter.get_article('1'), article1)
コード例 #2
0
    def test_articles(self):
        order = self.create_content('collective.cart.core.Order', id='1')
        adapter = IOrderAdapter(order)
        self.assertEqual(len(adapter.articles()), 0)

        self.create_content('collective.cart.core.OrderArticle', order, id='1')
        self.create_content('collective.cart.core.OrderArticle', order, id='2')
        self.assertEqual(len(adapter.articles()), 2)