def tearDown(self): # aparser = pamoney() setup_args = self.aparser.parser.parse_args( ('repo delete %s --in re qa' % self.rname).split()) pulp_admin = ja(setup_args) mute()(pulp_admin.delete_repo)(repo_name=setup_args.name, envs=setup_args.envs)
def test_search(self): self.args = self.parser.parser.parse_args('search ruby'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) self.args = self.parser.parser.parse_args(\ 'search ruby --in qa'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname)
def _test_pull(self): if os.path.exists(self.cpath): os.remove(self.cpath) self.args = self.parser.parser.parse_args(('cart pull %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.pull)(self.cname) self.assertTrue(os.path.exists(self.cpath))
def create_test_user(self): args = self.parser.parser.parse_args(("user create %s --password %s --name '%s' --in %s" % (self.testuser, self.testuser, self.testuser, self._defaults['start_in'])).split()) pulp = ja(args) mute()(pulp.create_user)(login=args.login, user_name=args.name, password=args.password, \ envs=args.envs)
def setUp(self): self.parser = pmoney() self.aparser = pamoney() self.cname = 'CHG0DAY' self.cpath = os.path.expanduser('~/.juicer-carts/%s.json' % self.cname) self.rname = 'hats' setup_args = self.aparser.parser.parse_args(\ ('create-repo %s --in re qa' % self.rname).split()) pulp_admin = ja(setup_args) mute()(pulp_admin.create_repo)(arch=setup_args.arch,\ repo_name=setup_args.name, envs=setup_args.envs)
def setUp(self): self.parser = pmoney() self.aparser = pamoney() self.cname = TESTCART self.cpath = os.path.expanduser('%s/%s.json' % (Constants.CART_LOCATION, self.cname)) self.rname = TESTREPO (self.connectors, self._defaults) = get_login_info() setup_args = self.aparser.parser.parse_args( ('repo create %s --in re qa' % self.rname).split()) pulp_admin = ja(setup_args) mute()(pulp_admin.create_repo)( repo_name=setup_args.name, envs=setup_args.envs)
def test_workflow(self): rpm_path = './share/juicer/empty-0.0.1-1.fc17.x86_64.rpm' if os.path.exists(self.cpath): os.remove(self.cpath) # test uploading an rpm self.args = self.parser.parser.parse_args(('upload -r %s %s' % ('hats', rpm_path)).split()) pulp = j(self.args) cart = pulp.create('upload-cart', self.args.r) self.args = self.parser.parser.parse_args('push upload-cart'.split()) pulp = j(self.args) mute()(pulp.push)(cart) # test creating a cart self.args = self.parser.parser.parse_args(('create CHG0DAY -r %s %s' \ % ('hats', rpm_path)).split()) pulp = j(self.args) mute()(pulp.create)(cart_name=self.args.cartname, cart_description=self.args.r) # test pushing a cart self.args = self.parser.parser.parse_args(('create %s -r hats %s' \ % (self.cname, rpm_path)).split()) pulp = j(self.args) cart = juicer.common.Cart.Cart(self.args.cartname, autoload=True, autosync=True) mute()(pulp.push)(cart=cart) # test promoting a cart cart = juicer.common.Cart.Cart(self.cname, autoload=True) old_env = cart.current_env self.args = self.parser.parser.parse_args(('promote %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.promote)(cart_name=self.args.cartname) cart = juicer.common.Cart.Cart(self.cname, autoload=True) self.assertFalse(cart.current_env == old_env) # test creating a cart from manifest new_cname = 'CHG1DAY' self.args = self.parser.parser.parse_args(('create %s -f %s' \ % (new_cname, './share/juicer/rpm-manifest.yaml')).split()) pulp = j(self.args) mute()(pulp.create_manifest)(cart_name=self.args.cartname, manifests=self.args.f) cart = juicer.common.Cart.Cart(new_cname, autoload=True) self.assertFalse(cart.is_empty())
def test_show_user(self): self.create_test_user() args = self.parser.parser.parse_args('show-user cjesop'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.show_user)(login=args.login, envs=args.envs) self.assertTrue(any('cjesop' in k for k in output)) self.delete_test_user()
def test_show_repo(self): self.create_test_repo() args = self.parser.parser.parse_args('show-repo test-repo-456'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.show_repo)(repo_name=args.name, envs=args.envs) self.assertTrue(any('test-repo-456' in k for k in output)) self.delete_test_repo()
def test_create_user(self): args = self.parser.parser.parse_args('create-user cjesop --password cjesop --name "ColonelJesop"'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.create_user)(login=args.login, user_name=args.name, \ password=args.password, envs=args.envs) self.assertTrue(any('created' in k for k in output)) self.delete_test_user()
def test_show_user(self): self.create_test_user() args = self.parser.parser.parse_args(("user show cjesop --in %s" % self._defaults['start_in']).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.show_user)(login=args.login, envs=args.envs) self.assertTrue(any('cjesop' in k for k in output)) self.delete_test_user()
def test_list_repos(self): self.create_test_repo() args = self.parser.parser.parse_args('list-repos'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.list_repos)(envs=args.envs) self.assertTrue('test-repo-456' in output) self.delete_test_repo()
def test_create_user(self): args = self.parser.parser.parse_args(("user create cjesop --password cjesop --name 'ColonelJesop' --in %s" % self._defaults['start_in']).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.create_user)(login=args.login, user_name=args.name, \ password=args.password, envs=args.envs) self.assertTrue(any((('created' in k) or ('shares' in k)) for k in output)) self.delete_test_user()
def test_list_repos(self): self.create_test_repo() args = self.parser.parser.parse_args(("repo list --in %s" % self._defaults['start_in']).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.list_repos)(envs=args.envs) self.assertTrue('test-repo-456' in output) self.delete_test_repo()
def test_show_repo(self): self.create_test_repo() args = self.parser.parser.parse_args(("repo show test-repo-456 --in %s" % self._defaults['start_in']).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.show_repo)(repo_name=args.name, envs=args.envs) self.assertTrue(any('test-repo-456' in k for k in output)) self.delete_test_repo()
def _test_delete_user(self): self.create_test_user() args = self.parser.parser.parse_args(("user delete %s --in %s" % (self.testuser, self._defaults['start_in'])).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.delete_user)(login=args.login, envs=args.envs) self.assertTrue(any('deleted' in k for k in output))
def _test_delete_repo(self): self.create_test_repo() args = self.parser.parser.parse_args(("repo delete %s --in %s" % (self.testrepo, self._defaults['start_in'])).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.delete_repo)(repo_name=args.name, envs=args.envs) self.assertTrue(any('deleted' in k for k in output))
def test_role_add(self): self.create_test_user() args = self.parser.parser.parse_args('role-add --login cjesop \ --role super-users'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.role_add)(role=args.role, login=args.login, envs=args.envs) self.assertTrue(any('added' in k for k in output)) self.delete_test_user()
def _test_create_repo(self): args = self.parser.parser.parse_args(("repo create %s --in %s" % (self.testrepo, self._defaults['start_in'])).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.create_repo)(repo_name=args.name, envs=args.envs) self.assertTrue(any('created' in k for k in output), msg="'created' not in output: %s" % juicer.utils.create_json_str(output, indent=4, cls=juicer.common.Repo.RepoEncoder)) self.delete_test_repo()
def _test_role_add(self): self.create_test_user() args = self.parser.parser.parse_args(("role add --login %s --role super-users --in %s" % (self.testuser, self._defaults['start_in'])).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.role_add)(role=args.role, login=args.login, envs=args.envs) self.assertTrue(any('added' in k for k in output)) self.delete_test_user()
def _test_create_user(self): args = self.parser.parser.parse_args(("user create %s --password %s --name '%s' --in %s" % (self.testuser, self.testuser, self.testuser, self._defaults['start_in'])).split()) pulp = ja(args) output = mute(returns_output=True)(pulp.create_user)(login=args.login, user_name=args.name, \ password=args.password, envs=args.envs) self.assertTrue(any((('created' in k) or ('shares' in k)) for k in output)) self.delete_test_user()
def _test_list_repos(self): self.create_test_repo() env = self._defaults['start_in'] args = self.parser.parser.parse_args(("repo list --in %s" % env).split()) pulp = ja(args) output = mute()(pulp.list_repos)(envs=args.envs) env_output = output[env] self.assertTrue(self.testrepo in env_output, msg="Expected to find %s in output: %s" % (self.testrepo, juicer.utils.create_json_str(output, indent=4, cls=juicer.common.Repo.RepoEncoder))) self.delete_test_repo()
def _test_show_repo(self): self.create_test_repo() env = self._defaults['start_in'] args = self.parser.parser.parse_args(("repo show %s --in %s" % (self.testrepo, env)).split()) pulp = ja(args) output = mute()(pulp.show_repo)(repo_names=args.name, envs=args.envs) env_output = output[env][0] self.assertEqual(self.testrepo, env_output['name'], msg="Expected to see %s in %s" % (self.testrepo, juicer.utils.create_json_str(env_output, indent=4, cls=juicer.common.Repo.RepoEncoder))) self.delete_test_repo()
def delete_test_repo(self): args = self.parser.parser.parse_args(("repo delete %s --in %s" % (self.testrepo, self._defaults['start_in'])).split()) pulp = ja(args) mute()(pulp.delete_repo)(repo_name=args.name, envs=args.envs)
def _test_show(self): self.args = self.parser.parser.parse_args(('cart show %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.show)(self.cname, get_environments())
def test_hello(self): self.args = self.parser.parser.parse_args('hello'.split()) pulp = j(self.args) mute()(pulp.hello)()
def test_show(self): self.args = self.parser.parser.parse_args(('show %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.show)(self.cname)
def test_show(self): self.args = self.parser.parser.parse_args( ('show %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.show)(self.cname)
def test_workflow(self): rpm_path = './share/juicer/empty-0.0.1-1.fc17.x86_64.rpm' if os.path.exists(self.cpath): os.remove(self.cpath) # test uploading an rpm self.args = self.parser.parser.parse_args(\ ('upload -r %s %s' % (self.rname, rpm_path)).split()) pulp = j(self.args) cart = pulp.create('upload-cart', self.args.r) self.args = self.parser.parser.parse_args('push upload-cart'.split()) pulp = j(self.args) mute()(pulp.push)(cart) # test searching for an rpm self.args = self.parser.parser.parse_args('search %s'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) self.args = self.parser.parser.parse_args(\ 'search %s --in re'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) # test creating a cart self.args = self.parser.parser.parse_args(('create CHG0DAY -r %s %s' \ % ('hats', rpm_path)).split()) pulp = j(self.args) mute()(pulp.create)(cart_name=self.args.cartname, cart_description=self.args.r) # test pushing a cart self.args = self.parser.parser.parse_args(('create %s -r hats %s' \ % (self.cname, rpm_path)).split()) pulp = j(self.args) cart = juicer.common.Cart.Cart(self.args.cartname, autoload=True, autosync=True) mute()(pulp.push)(cart=cart) # test promoting a cart cart = juicer.common.Cart.Cart(self.cname, autoload=True) old_env = cart.current_env self.args = self.parser.parser.parse_args( ('promote %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.promote)(cart_name=self.args.cartname) cart = juicer.common.Cart.Cart(self.cname, autoload=True) self.assertFalse(cart.current_env == old_env) # test creating a cart from manifest new_cname = 'CHG1DAY' self.args = self.parser.parser.parse_args(('create %s -f %s' \ % (new_cname, './share/juicer/rpm-manifest.yaml')).split()) pulp = j(self.args) mute()(pulp.create_manifest)(cart_name=self.args.cartname, manifests=self.args.f) cart = juicer.common.Cart.Cart(new_cname, autoload=True) self.assertFalse(cart.is_empty())
def delete_test_user(self): args = self.parser.parser.parse_args('delete-user cjesop'.split()) pulp = ja(args) mute()(pulp.delete_user)(login=args.login, envs=args.envs)
def _test_workflow(self): rpm_path = '../../share/juicer/empty-0.1-1.noarch.rpm' rpm2_path = '../../share/juicer/alsoempty-0.1-1.noarch.rpm' if os.path.exists(self.cpath): os.remove(self.cpath) # test uploading an rpm self.args = self.parser.parser.parse_args( ('rpm upload -r %s %s' % (self.rname, rpm_path)).split()) pulp = j(self.args) cart = pulp.create('upload-cart', self.args.r) self.args = self.parser.parser.parse_args( 'cart push upload-cart'.split()) pulp = j(self.args) mute()(pulp.push)(cart) # test searching for an rpm self.args = self.parser.parser.parse_args('rpm search %s'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) self.args = self.parser.parser.parse_args( 'rpm search %s --in re'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) # test creating a cart self.args = self.parser.parser.parse_args( ('cart create %s -r %s %s %s' % (self.cname, self.rname, rpm_path, rpm2_path)).split()) pulp = j(self.args) mute()(pulp.create)(cart_name=self.args.cartname, cart_description=self.args.r) # test pushing a cart self.args = self.parser.parser.parse_args( ('cart create %s -r %s %s' % (self.cname, self.rname, rpm_path)).split()) pulp = j(self.args) cart = juicer.common.Cart.Cart(self.args.cartname, autoload=True, autosync=True) mute()(pulp.push)(cart=cart) # test promoting a cart cart = juicer.common.Cart.Cart(self.cname, autoload=True) old_env = cart.current_env self.args = self.parser.parser.parse_args( ('cart promote %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.promote)(cart_name=self.args.cartname) cart = juicer.common.Cart.Cart(self.cname, autoload=True) self.assertFalse(cart.current_env == old_env) # test creating a cart from manifest new_cname = self.cname + "1" self.args = self.parser.parser.parse_args( ('cart create %s -f %s' % (new_cname, '../../share/juicer/rpm-manifest.yaml')).split()) pulp = j(self.args) mute()(pulp.create_manifest)(cart_name=self.args.cartname, manifests=self.args.f) cart = juicer.common.Cart.Cart(new_cname, autoload=True) self.assertFalse(cart.is_empty()) # test deleting a cart self.args = self.parser.parser.parse_args(('cart delete %s' % \ (self.cname)).split()) pulp = j(self.args) mute()(pulp.delete)(cartname=cart.cart_name) self.assertFalse(os.path.exists(cart.cart_file())) cart = juicer.common.Cart.Cart(self.cname, autoload=True) mute()(pulp.delete)(cartname=cart.cart_name) self.assertFalse(os.path.exists(cart.cart_file()))
def test_create_repo(self): args = self.parser.parser.parse_args('create-repo test-repo-456'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.create_repo)(arch=args.arch, repo_name=args.name, envs=args.envs) self.assertTrue(any('created' in k for k in output)) self.delete_test_repo()
def test_list_roles(self): args = self.parser.parser.parse_args('list-roles'.split()) pulp = ja(args) output = mute(returns_output=True)(pulp.list_roles)(envs=args.envs) self.assertTrue(any('super-users' in k for k in output))
def delete_test_repo(self): args = self.parser.parser.parse_args('delete-repo test-repo-456'.split()) pulp = ja(args) mute()(pulp.delete_repo)(repo_name=args.name, envs=args.envs)
def create_test_repo(self): args = self.parser.parser.parse_args('create-repo test-repo-456'.split()) pulp = ja(args) mute()(pulp.create_repo)(arch=args.arch, repo_name=args.name, envs=args.envs)
def _test_hello(self): self.args = self.parser.parser.parse_args(("hello --in %s" % self._defaults['start_in']).split()) pulp = j(self.args) mute()(pulp.hello)()
def _test_show(self): self.args = self.parser.parser.parse_args( ('cart show %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.show)(self.cname, get_environments())
def create_test_user(self): args = self.parser.parser.parse_args('create-user cjesop --password cjesop --name "ColonelJesop"'.split()) pulp = ja(args) mute()(pulp.create_user)(login=args.login, user_name=args.name, password=args.password, \ envs=args.envs)
def _test_workflow(self): rpm_path = '../../share/juicer/empty-0.1-1.noarch.rpm' rpm2_path = '../../share/juicer/alsoempty-0.1-1.noarch.rpm' if os.path.exists(self.cpath): os.remove(self.cpath) # test uploading an rpm self.args = self.parser.parser.parse_args( ('rpm upload -r %s %s' % (self.rname, rpm_path)).split()) pulp = j(self.args) cart = pulp.create('upload-cart', self.args.r) self.args = self.parser.parser.parse_args('cart push upload-cart'.split()) pulp = j(self.args) mute()(pulp.push)(cart) # test searching for an rpm self.args = self.parser.parser.parse_args('rpm search %s'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) self.args = self.parser.parser.parse_args( 'rpm search %s --in re'.split()) pulp = j(self.args) mute()(pulp.search)(pkg_name=self.args.rpmname) # test creating a cart self.args = self.parser.parser.parse_args(('cart create %s -r %s %s %s' % (self.cname, self.rname, rpm_path, rpm2_path)).split()) pulp = j(self.args) mute()(pulp.create)(cart_name=self.args.cartname, cart_description=self.args.r) # test pushing a cart self.args = self.parser.parser.parse_args(('cart create %s -r %s %s' % (self.cname, self.rname, rpm_path)).split()) pulp = j(self.args) cart = juicer.common.Cart.Cart(self.args.cartname, autoload=True, autosync=True) mute()(pulp.push)(cart=cart) # test promoting a cart cart = juicer.common.Cart.Cart(self.cname, autoload=True) old_env = cart.current_env self.args = self.parser.parser.parse_args(('cart promote %s' % self.cname).split()) pulp = j(self.args) mute()(pulp.promote)(cart_name=self.args.cartname) cart = juicer.common.Cart.Cart(self.cname, autoload=True) self.assertFalse(cart.current_env == old_env) # test creating a cart from manifest new_cname = self.cname + "1" self.args = self.parser.parser.parse_args(('cart create %s -f %s' % (new_cname, '../../share/juicer/rpm-manifest.yaml')).split()) pulp = j(self.args) mute()(pulp.create_manifest)(cart_name=self.args.cartname, manifests=self.args.f) cart = juicer.common.Cart.Cart(new_cname, autoload=True) self.assertFalse(cart.is_empty()) # test deleting a cart self.args = self.parser.parser.parse_args(('cart delete %s' % \ (self.cname)).split()) pulp = j(self.args) mute()(pulp.delete)(cartname=cart.cart_name) self.assertFalse(os.path.exists(cart.cart_file())) cart = juicer.common.Cart.Cart(self.cname, autoload=True) mute()(pulp.delete)(cartname=cart.cart_name) self.assertFalse(os.path.exists(cart.cart_file()))
def _test_hello(self): self.args = self.parser.parser.parse_args( ("hello --in %s" % self._defaults['start_in']).split()) pulp = j(self.args) mute()(pulp.hello)()