-
Sub-task
-
Resolution: Unresolved
-
Critical
-
None
-
None
-
None
-
False
-
-
False
-
subs-swatch-thunder
-
-
-
Swatch Thunder Sprint 2
application = <iqe.base.application.Application object at 0x7fed72b45b80> rhsm_admin_user = <Box: {'auth': {'username': 'rbac-admin25', 'password': 'redhatqa', 'refresh_token': 'eyJhbGciOiJIUzUxMiIsInR5cCIgOiAi...saWVudF90eXBlLnByZV9rYzI1In0.XhwEt3nAwii1BsRK8bGAm3qOFDJR5heVdg5ebKBhcUNj4bYJZty85gUKPkZ8KFXPoK7ZZ80GXt82U5cbm9nXgg'}}> rhsm_non_admin_user = <Box: {'auth': {'username': 'rbacnoadmin25', 'password': 'redhatswatchqe', 'refresh_token': 'eyJhbGciOiJIUzUxMiIsInR5c...bGllbnRfdHlwZS5wcmVfa2MyNSJ9.4Clf_kqEzHBXfqJAtIrSqjfTG36sQGLgK6Q8ixzYw3wyd1WEJgKzkV9I92aNmZFxNvbVR9Tudqf756pO6KPd_A'}}> @pytest.fixture(scope="function") def add_non_admin_user_to_swatch_read_group(application, rhsm_admin_user, rhsm_non_admin_user): """Non admin user should be in same account of admin user""" with application.copy_using(user=rhsm_admin_user) as app: group = app.rbac.rest_client.group_api.create_group( {"name": f"swatch-admin-{uuid.uuid4()}", "description": "test"} ) role = app.rbac.rest_client.role_api.list_roles(name="Subscriptions user") app.rbac.rest_client.group_api.add_role_to_group(group.uuid, {"roles": [role.data[0].uuid]}) > app.rbac.rest_client.group_api.add_principal_to_group( group.uuid, {"principals": [{"username": rhsm_non_admin_user.auth.username}]} ) /iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/fixtures/rbac.py:134: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/api/group_api.py:62: in add_principal_to_group return self.add_principal_to_group_with_http_info(uuid, group_principal_in, **kwargs) # noqa: E501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/api/group_api.py:148: in add_principal_to_group_with_http_info return self.api_client.call_api( /iqe_venv/lib/python3.12/site-packages/iqe/base/rest_client.py:153: in call_api resp = super().call_api(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/api_client.py:364: in call_api return self.__call_api(resource_path, method, /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/api_client.py:188: in __call_api raise e /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/api_client.py:181: in __call_api response_data = self.request( /iqe_venv/lib/python3.12/site-packages/iqe/base/rest_client.py:130: in request raise err /iqe_venv/lib/python3.12/site-packages/iqe/base/rest_client.py:124: in request response = super().request( /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/api_client.py:407: in request return self.rest_client.POST(url, /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/rest.py:265: in POST return self.request("POST", url, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <iqe_rbac_api.rest.RESTClientObject object at 0x7fed6a8481a0> method = 'POST' url = 'https://console.stage.redhat.com/api/rbac/v1/groups/3ed9f4fb-1451-4c50-8dd0-62a00e696639/principals/' query_params = [] headers = {'Accept': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJiaTZWTjlMQV...KzA-0RdtMiKyLpZ07aBfTuvDDswHlePJQ', 'Content-Type': 'application/json', 'User-Agent': 'OpenAPI-Generator/1.0.0/python'} body = {'principals': [{'username': 'rbacnoadmin25'}]}, post_params = {} _preload_content = True, _request_timeout = None def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None): """Perform requests. :param method: http request method :param url: http request url :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ method = method.upper() assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] if post_params and body: raise ApiValueError( "body parameter cannot be used with post_params parameter." ) post_params = post_params or {} headers = headers or {} timeout = None if _request_timeout: if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) elif (isinstance(_request_timeout, tuple) and len(_request_timeout) == 2): timeout = urllib3.Timeout( connect=_request_timeout[0], read=_request_timeout[1]) if 'Content-Type' not in headers: headers['Content-Type'] = 'application/json' try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: if query_params: url += '?' + urlencode(query_params) if re.search('json', headers['Content-Type'], re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( method, url, body=request_body, preload_content=_preload_content, timeout=timeout, headers=headers) elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( method, url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, headers=headers) elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. del headers['Content-Type'] r = self.pool_manager.request( method, url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, headers=headers) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( method, url, body=request_body, preload_content=_preload_content, timeout=timeout, headers=headers) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided arguments. Please check that your arguments match declared content type.""" raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: r = self.pool_manager.request(method, url, fields=query_params, preload_content=_preload_content, timeout=timeout, headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) if _preload_content: r = RESTResponse(r) # log response body logger.debug("response body: %s", r.data) if not 200 <= r.status <= 299: > raise ApiException(http_resp=r) E iqe_rbac_api.exceptions.ApiException: (404) E Reason: Not Found E HTTP response headers: HTTPHeaderDict({'Server': 'openresty', 'Content-Type': 'application/json', 'Content-Length': '92', 'x-rh-insights-request-id': '7627b631def748a7bbf5fd02c9837513', 'Allow': 'GET, POST, DELETE, HEAD, OPTIONS', 'x-frame-options': 'DENY', 'x-content-type-options': 'nosniff', 'referrer-policy': 'same-origin', 'cross-origin-opener-policy': 'same-origin', 'Vary': 'origin', 'Date': 'Tue, 07 Oct 2025 21:12:29 GMT', 'Connection': 'close', 'Set-Cookie': 'e15dd7c1deaec3a6b67fca153d520b0b=34e9e2e1aa74328b64a5d899ae035065; path=/; HttpOnly; Secure; SameSite=None', 'x-rh-edge-request-id': '3ecb32b2', 'x-rh-edge-reference-id': '0.9a6bdc17.1759871549.3ecb32b2', 'x-rh-edge-cache-status': 'NotCacheable from child', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'}) E HTTP response body: {"errors":[{"detail":"No Group matches the given query.","source":"detail","status":"404"}]} /iqe_venv/lib/python3.12/site-packages/iqe_rbac_api/rest.py:224: ApiException
- relates to
-
SWATCH-4069 test_rbac.py::test_verify_rbac_not_opt_in_and_with_subscriptions_user_permission
-
- To Do
-