def test_cart_load(self): """A loaded cart is not empty""" with mock.patch('juicer.common.Constants') as constants: constants.CART_LOCATION = './' constants.USER_CONFIG = './config' cart = juicer.cart.Cart(name='cart', autoload=True) self.assertEqual(cart.repos(), ['test']) self.assertEqual(cart.is_empty(), False) self.assertEqual(cart.items()[0].name, 'empty-0.1-1.noarch.rpm')
def test_cart_with_provided_description(self): """A cart with items is not empty""" with mock.patch('juicer.common.Constants') as constants: constants.CART_LOCATION = './' constants.USER_CONFIG = './config' cart = juicer.cart.Cart(name='test-cart', description={'test-repo': ['share/juicer/empty-0.1-1.noarch.rpm']}) self.assertEqual(cart.repos(), ['test-repo']) self.assertEqual(cart.keys(), ['test-repo']) self.assertEqual(cart.is_empty(), False) self.assertIsInstance(str(cart), str)