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
    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_entitlements(org_id, 'enterprise_entitled', 1)
        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
Esempio n. 3
0
    def test_grant_entitlements_q(self):
        "Grant entitlements"
        org_id = misc_functions.create_new_org()
        entitlement_level = 'provisioning_entitled'
        quantity = 17

        misc_functions.grant_entitlements(org_id, entitlement_level, quantity)

        # Verify
        h = rhnSQL.prepare("""
            select sg.max_members quantity
              from rhnServerGroupType sgt, rhnServerGroup sg
             where sg.org_id = :org_id
               and sg.group_type = sgt.id
               and sgt.label = :entitlement_level
        """)
        h.execute(org_id=org_id, entitlement_level=entitlement_level)
        row = h.fetchone_dict()

        self.assertNotEqual(row, None)
        self.assertEqual(row['quantity'], quantity)
Esempio n. 4
0
    def test_grant_entitlements_q(self):
        "Grant entitlements"
        org_id = misc_functions.create_new_org()
        entitlement_level = 'provisioning_entitled'
        quantity = 17

        misc_functions.grant_entitlements(org_id, entitlement_level, quantity)

        # Verify
        h = rhnSQL.prepare("""
            select sg.max_members quantity
              from rhnServerGroupType sgt, rhnServerGroup sg
             where sg.org_id = :org_id
               and sg.group_type = sgt.id
               and sgt.label = :entitlement_level
        """)
        h.execute(org_id=org_id, entitlement_level=entitlement_level)
        row = h.fetchone_dict()

        self.assertNotEqual(row, None)
        self.assertEqual(row['quantity'], 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_entitlements(org_id, 'enterprise_entitled', 1)
        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