def test_positive_delete_cloned_builtin(self): """Clone a builtin role and attempt to delete it :id: 1fd9c636-596a-4cb2-b100-de19238042cc :BZ: 1426672 :expectedresults: role was successfully deleted :CaseImportance: Critical """ role_list = Role.list({'search': f'name=\\"{choice(ROLES)}\\"'}) assert len(role_list) == 1 cloned_role = Role.clone({'id': role_list[0]['id'], 'new-name': gen_string('alphanumeric')}) Role.delete({'id': cloned_role['id']}) with pytest.raises(CLIReturnCodeError): Role.info({'id': cloned_role['id']})
def setUpClass(cls): """ Initializes class attribute ``dct_roles`` with several random roles saved on sat. roles is a dict so keys are role's id respective value is the role itself """ super(UserWithCleanUpTestCase, cls).setUpClass() settings.configure() include_list = [gen_string("alphanumeric", 100)] def roles_helper(): """Generator funcion which creates several Roles to be used on tests """ for role_name in valid_usernames_list() + include_list: yield make_role({'name': role_name}) cls.stubbed_roles = {role['id']: role for role in roles_helper()} cls.all_roles = {role['id']: role for role in Role.list()}
def test_positive_delete_cloned_builtin(self): """Clone a builtin role and attempt to delete it :id: 1fd9c636-596a-4cb2-b100-de19238042cc :BZ: 1426672 :expectedresults: role was successfully deleted :CaseImportance: Critical """ role_list = Role.list({ 'search': 'name=\\"{}\\"'.format(choice(ROLES))}) self.assertEqual(len(role_list), 1) cloned_role = Role.clone({ 'id': role_list[0]['id'], 'new-name': gen_string('alphanumeric'), }) Role.delete({'id': cloned_role['id']}) with self.assertRaises(CLIReturnCodeError): Role.info({'id': cloned_role['id']})