def CartUpdateCommand(args): # pragma: no cover jc = JuicerCommand(args) cart = juicer.cart.Cart(jc.args.cartname, autoload=True) filtered_repo_items = juicer.remotes.filter_items(jc.args.r, cart.cart_type) cart.update(filtered_repo_items)
def test_cart_update(self): """Cart can be updated""" with nested( mock.patch('juicer.common.Constants'), mock.patch('pymongo.MongoClient')) as ( constants, MongoClient): # Override 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']}) cart.update([['test-repo', 'share/juicer/empty-0.1-1.noarch.rpm']]) self.assertEqual(cart.items()[0].name, 'empty-0.1-1.noarch.rpm') cart.delete() self.assertFalse(os.path.exists(cart.cart_file))