Esempio n. 1
0
    def test_positive_remove_user_assigned_to_usergroup(self):
        """Create new user and assign it to user group. Then remove that user.

        :id: 2a2623ce-4723-4402-aae7-8675473fd8bd

        :expectedresults: User should delete successfully.

        :CaseLevel: Integration
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({'id': user_group['id'], 'user-id': user['id']})
        with self.assertNotRaises(CLIReturnCodeError):
            User.delete({'id': user['id']})
Esempio n. 2
0
    def test_positive_remove_user_assigned_to_usergroup(self):
        """Create new user and assign it to user group. Then remove that user.

        :id: 2a2623ce-4723-4402-aae7-8675473fd8bd

        :expectedresults: User should delete successfully.

        :CaseLevel: Integration
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({'id': user_group['id'], 'user-id': user['id']})
        with self.assertNotRaises(CLIReturnCodeError):
            User.delete({'id': user['id']})
Esempio n. 3
0
    def test_positive_create_and_refresh_external_usergroup_with_local_user(
            self):
        """Create and Refresh external user group with FreeIPA LDAP. Verify Local user
           association from user-group with external group with FreeIPA LDAP

        :id: bd6152e3-51ac-4e84-b084-8bab1c4eb583

        :expectedresults: User group is created successfully and assigned to correct auth
             source. User group is refreshed successfully. Local user is associated from
             user group with external group.

        :CaseLevel: Integration

        :BZ: 1412209
        """
        ext_user_group = make_usergroup_external({
            'auth-source-id':
            self.auth['server']['id'],
            'user-group-id':
            self.user_group['id'],
            'name':
            'foobargroup',
        })
        self.assertEqual(ext_user_group['auth-source'],
                         self.auth['server']['name'])
        with self.assertNotRaises(CLIReturnCodeError):
            UserGroupExternal.refresh({
                'user-group-id': self.user_group['id'],
                'name': 'foobargroup'
            })
        user = make_user()
        UserGroup.add_user({
            'user': user['login'],
            'id': self.user_group['id']
        })
        self.assertEqual(
            User.info({'login': user['login']})['user-groups'][0]['usergroup'],
            self.user_group['name'],
        )
        with self.assertNotRaises(CLIReturnCodeError):
            UserGroupExternal.refresh({
                'user-group-id': self.user_group['id'],
                'name': 'foobargroup'
            })
        print(User.info({'login': user['login']}))
        self.assertEqual(
            User.info({'login': user['login']})['user-groups'][0]['usergroup'],
            self.user_group['name'],
        )
Esempio n. 4
0
    def test_positive_add_user_by_name(self):
        """Create new user group and new user. Then add created user to user
        group by name

        @Feature: Usergroup

        @Assert: User is added to user group successfully.
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({
            'id': user_group['id'],
            'user': user['login'],
        })
        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(user_group['users'][0], user['login'])
    def test_positive_add_user_by_name(self):
        """Create new user group and new user. Then add created user to user
        group by name

        @Feature: Usergroup

        @Assert: User is added to user group successfully.
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({
            'id': user_group['id'],
            'user': user['login'],
        })
        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(user_group['users'][0], user['login'])
Esempio n. 6
0
    def test_positive_create_and_refresh_external_usergroup_with_local_user(
            self):
        """Create and refresh external user group with AD LDAP. Verify Local user
           association from user-group with external group with AD LDAP

        :id: 7431979c-aea8-4984-bb7d-185f5b7c3109

        :expectedresults: User group is created and refreshed successfully.
            Local user is associated from user-group with external group.

        :CaseLevel: Integration

        :BZ: 1412209
        """
        ext_user_group = make_usergroup_external({
            'auth-source-id':
            self.auth['server']['id'],
            'user-group-id':
            self.user_group['id'],
            'name':
            'foobargroup',
        })
        self.assertEqual(ext_user_group['auth-source'],
                         self.auth['server']['name'])
        with self.assertNotRaises(CLIReturnCodeError):
            UserGroupExternal.refresh({
                'user-group-id': self.user_group['id'],
                'name': 'foobargroup'
            })
        user = make_user()
        UserGroup.add_user({
            'user': user['login'],
            'id': self.user_group['id']
        })
        self.assertEqual(
            User.info({'login': user['login']})['user-groups'][0]['usergroup'],
            self.user_group['name'],
        )
        with self.assertNotRaises(CLIReturnCodeError):
            UserGroupExternal.refresh({
                'user-group-id': self.user_group['id'],
                'name': 'foobargroup'
            })
        self.assertEqual(
            User.info({'login': user['login']})['user-groups'][0]['usergroup'],
            self.user_group['name'],
        )
Esempio n. 7
0
    def test_positive_add_and_remove_elements(self):
        """Create new user group. Add and remove several element from the group.

        :id: a4ce8724-d3c8-4c00-9421-aaa40394134d

        :BZ: 1395229

        :expectedresults: Elements are added to user group and then removed
                          successfully.

        :CaseLevel: Integration
        """
        role = make_role()
        user_group = make_usergroup()
        user = make_user()
        sub_user_group = make_usergroup()

        # Add elements by id
        UserGroup.add_role({'id': user_group['id'], 'role-id': role['id']})
        UserGroup.add_user({'id': user_group['id'], 'user-id': user['id']})
        UserGroup.add_user_group({
            'id': user_group['id'],
            'user-group-id': sub_user_group['id']
        })

        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(len(user_group['roles']), 1)
        self.assertEqual(user_group['roles'][0], role['name'])
        self.assertEqual(len(user_group['users']), 1)
        self.assertEqual(user_group['users'][0], user['login'])
        self.assertEqual(len(user_group['user-groups']), 1)
        self.assertEqual(user_group['user-groups'][0]['usergroup'],
                         sub_user_group['name'])

        # Remove elements by name
        UserGroup.remove_role({'id': user_group['id'], 'role': role['name']})
        UserGroup.remove_user({'id': user_group['id'], 'user': user['login']})
        UserGroup.remove_user_group({
            'id': user_group['id'],
            'user-group': sub_user_group['name']
        })

        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(len(user_group['roles']), 0)
        self.assertEqual(len(user_group['users']), 0)
        self.assertEqual(len(user_group['user-groups']), 0)
Esempio n. 8
0
def test_positive_remove_user_assigned_to_usergroup():
    """Create new user and assign it to user group. Then remove that user.

    :id: 2a2623ce-4723-4402-aae7-8675473fd8bd

    :expectedresults: User should delete successfully.

    :CaseLevel: Integration

    :BZ: 1667704
    """
    user = make_user()
    user_group = make_usergroup()
    UserGroup.add_user({'id': user_group['id'], 'user-id': user['id']})
    User.delete({'id': user['id']})
    user_group = UserGroup.info({'id': user_group['id']})
    assert user['login'] not in user_group['users']
Esempio n. 9
0
    def test_positive_add_user_by_name(self):
        """Create new user group and new user. Then add created user to user
        group by name

        :id: f622eb11-a3d2-4a25-8889-766133750431

        :expectedresults: User is added to user group successfully.

        :CaseLevel: Integration
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({
            'id': user_group['id'],
            'user': user['login'],
        })
        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(user_group['users'][0], user['login'])
Esempio n. 10
0
    def test_positive_add_user_by_id(self):
        """Create new user group and new user. Then add created user to user
        group by id

        :id: f2972e48-67c3-4dc9-8c4b-aa550086afb7

        :expectedresults: User is added to user group successfully.

        :CaseLevel: Integration
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({
            'id': user_group['id'],
            'user-id': user['id'],
        })
        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(user_group['users'][0], user['login'])
Esempio n. 11
0
    def test_positive_add_user_by_name(self):
        """Create new user group and new user. Then add created user to user
        group by name

        :id: f622eb11-a3d2-4a25-8889-766133750431

        :expectedresults: User is added to user group successfully.

        :CaseLevel: Integration
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({
            'id': user_group['id'],
            'user': user['login'],
        })
        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(user_group['users'][0], user['login'])
Esempio n. 12
0
    def test_positive_add_user_by_id(self):
        """Create new user group and new user. Then add created user to user
        group by id

        :id: f2972e48-67c3-4dc9-8c4b-aa550086afb7

        :expectedresults: User is added to user group successfully.

        :CaseLevel: Integration
        """
        user = make_user()
        user_group = make_usergroup()
        UserGroup.add_user({
            'id': user_group['id'],
            'user-id': user['id'],
        })
        user_group = UserGroup.info({'id': user_group['id']})
        self.assertEqual(user_group['users'][0], user['login'])
Esempio n. 13
0
    def test_positive_local_user_with_external_usergroup(self):
        """Verify Local user association from user-group with external group with AD LDAP

        :id: 7431979c-aea8-4984-bb7d-185f5b7c3109

        :expectedresults: Local user is associated from user-group with external group.

        :CaseLevel: Integration

        :BZ: 1412209
        """
        ext_user_group = make_usergroup_external({
            'auth-source-id': self.auth['server']['id'],
            'user-group-id': self.user_group['id'],
            'name': 'foobargroup'
        })
        self.assertEqual(
            ext_user_group['auth-source'], self.auth['server']['name']
        )
        with self.assertNotRaises(CLIReturnCodeError):
            UserGroupExternal.refresh({
                'user-group-id': self.user_group['id'],
                'name': 'foobargroup'
            })
        user = make_user()
        UserGroup.add_user({
            'user': user['login'],
            'id': self.user_group['id']
        })
        print(User.info({'login': user['login']}))
        self.assertEqual(
            User.info({'login': user['login']})['user-groups'][0]['usergroup'],
            self.user_group['name']
        )
        with self.assertNotRaises(CLIReturnCodeError):
            UserGroupExternal.refresh({
                'user-group-id': self.user_group['id'],
                'name': 'foobargroup'
            })
        print(User.info({'login': user['login']}))
        self.assertEqual(
            User.info({'login': user['login']})['user-groups'][0]['usergroup'],
            self.user_group['name']
        )