def _create_new_user(self):
        # Create new org
        org_id = misc_functions.create_new_org()

        # Grant entitlements to the org
        misc_functions.grant_entitlements(org_id, 'enterprise_entitled', 1)
        misc_functions.grant_channel_family_entitlements(org_id,
            self._channel_family, 1) 
        
        # Create new user
        u = misc_functions.create_new_user(org_id=org_id, roles=['org_admin'])
        username = u.contact['login']
        # XXX This will break on satellites where passwords are encrypted
        password = u.contact['password']
        return u
Example #2
0
    def _create_new_user(self):
        # Create new org
        org_id = misc_functions.create_new_org()
        users_unencrypted_password = "******" % time.time()

        # Grant entitlements to the org
        misc_functions.grant_channel_family_entitlements(
            org_id, "%s-%.3f" % (self._channel_family, time.time()), 1)

        # Create new user
        u = misc_functions.create_new_user(
            org_id=org_id,
            roles=['org_admin'],
            password=users_unencrypted_password,
            encrypt_password=CFG.encrypted_passwords)

        return u, users_unencrypted_password
    def test_remaining_subscriptions_1(self):
        "Test registration.remaining_subscriptions call, used by RHEL4+ clients"
        org_id = misc_functions.create_new_org()
        u = misc_functions.create_new_user(org_id=org_id)

        quantity = 15
        channel_family = self._channel_family
        arch = 'i686'
        release = '3AS'
        misc_functions.grant_channel_family_entitlements(org_id,
                                                         channel_family,
                                                         quantity)

        remaining = registration.Registration().remaining_subscriptions(u.contact['login'],
                                                                        u.contact['password'],
                                                                        arch,
                                                                        release)
        self.assertEqual(str(quantity), str(remaining))
Example #4
0
    def test_grant_channel_family_1(self):
        "Grant channel family entitlements"
        org_id = misc_functions.create_new_org()
        channel_family = 'rhel-as'
        quantity = 19
        misc_functions.grant_channel_family_entitlements(org_id,
                                                         channel_family, quantity)

        h = rhnSQL.prepare("""
            select cfp.max_members
              from rhnChannelFamily cf, rhnChannelFamilyPermissions cfp
             where cfp.org_id = :org_id
               and cfp.channel_family_id = cf.id
               and cf.label = :channel_family
        """)
        h.execute(org_id=org_id, channel_family=channel_family)
        row = h.fetchone_dict()
        self.assertNotEqual(row, None)
        self.assertEqual(row['max_members'], quantity)
    def test_grant_channel_family_1(self):
        "Grant channel family entitlements"
        org_id = misc_functions.create_new_org()
        channel_family = 'rhel-as'
        quantity = 19
        misc_functions.grant_channel_family_entitlements(
            org_id, channel_family, quantity)

        h = rhnSQL.prepare("""
            select cfp.max_members
              from rhnChannelFamily cf, rhnChannelFamilyPermissions cfp
             where cfp.org_id = :org_id
               and cfp.channel_family_id = cf.id
               and cf.label = :channel_family
        """)
        h.execute(org_id=org_id, channel_family=channel_family)
        row = h.fetchone_dict()
        self.assertNotEqual(row, None)
        self.assertEqual(row['max_members'], quantity)
    def _create_new_user(self):
        # Create new org
        org_id = misc_functions.create_new_org()
        users_unencrypted_password = "******" % time.time()

        # Grant entitlements to the org
        misc_functions.grant_channel_family_entitlements(
            org_id,
            "%s-%.3f" % (self._channel_family, time.time()),
            1
        )

        # Create new user
        u = misc_functions.create_new_user(
            org_id=org_id,
            roles=['org_admin'],
            password=users_unencrypted_password,
            encrypt_password=CFG.encrypted_passwords
        )

        return u, users_unencrypted_password