<?xml version="1.0" encoding="utf-8"?><testsuites name="pytest tests"><testsuite name="pytest" errors="0" failures="5" skipped="0" tests="11" time="1.696" timestamp="2026-06-09T15:22:09.401999+00:00" hostname="maas-group-test-k2q5p-e2e-maas-openshift-pod"><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyCRUD" name="test_create_api_key" time="0.128" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyCRUD" name="test_list_api_keys" time="0.156" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyCRUD" name="test_revoke_api_key" time="0.105" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyAuthorization" name="test_admin_manage_other_users_keys" time="0.146" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyAuthorization" name="test_non_admin_cannot_access_other_users_keys" time="0.107" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyBulkOperations" name="test_bulk_revoke_own_keys" time="0.285" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyBulkOperations" name="test_bulk_revoke_other_user_forbidden" time="0.038"><failure message="AssertionError: Expected 403, got 500: &#10;assert 500 == 403&#10; +  where 500 = &lt;Response [500]&gt;.status_code">self = &lt;test_api_keys.TestAPIKeyBulkOperations object at 0x7fc3305d9340&gt;
api_keys_base_url = 'https://maas.apps.16099dc7-4867-446d-a222-ff5afa97b9dc.prod.konfluxeaas.com/maas-api/v1/api-keys'
headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZWRG5TeC1EaUIzTzJkLURKY3p2ZU9sMkhXV2VwQWdBcVFQZGdKa2dlRDQifQ.e...RP_7SAwLkZfHaYBsDYYj0cBxSXVZGJ66UONxuHnoT1E0yz7XBPpXxOm7FAOfkv_vTjoio7VDBt8mjSvLg', 'Content-Type': 'application/json'}

    def test_bulk_revoke_other_user_forbidden(self, api_keys_base_url: str, headers: dict):
        """Test 9: Bulk revoke - non-admin cannot bulk revoke other user's keys."""
        # Try to bulk revoke another user's keys (should fail with 403)
        r_bulk = requests.post(
            f"{api_keys_base_url}/bulk-revoke",
            headers=headers,
            json={"username": "someotheruser"},
            timeout=30,
            verify=TLS_VERIFY
        )
&gt;       assert r_bulk.status_code == 403, f"Expected 403, got {r_bulk.status_code}: {r_bulk.text}"
E       AssertionError: Expected 403, got 500: 
E       assert 500 == 403
E        +  where 500 = &lt;Response [500]&gt;.status_code

test/e2e/tests/test_api_keys.py:343: AssertionError</failure></testcase><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyBulkOperations" name="test_bulk_revoke_admin_can_revoke_any_user" time="0.035"><failure message="assert 500 in (200, 201)&#10; +  where 500 = &lt;Response [500]&gt;.status_code">self = &lt;test_api_keys.TestAPIKeyBulkOperations object at 0x7fc3305d9400&gt;
api_keys_base_url = 'https://maas.apps.16099dc7-4867-446d-a222-ff5afa97b9dc.prod.konfluxeaas.com/maas-api/v1/api-keys'
headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZWRG5TeC1EaUIzTzJkLURKY3p2ZU9sMkhXV2VwQWdBcVFQZGdKa2dlRDQifQ.e...RP_7SAwLkZfHaYBsDYYj0cBxSXVZGJ66UONxuHnoT1E0yz7XBPpXxOm7FAOfkv_vTjoio7VDBt8mjSvLg', 'Content-Type': 'application/json'}
admin_headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZWRG5TeC1EaUIzTzJkLURKY3p2ZU9sMkhXV2VwQWdBcVFQZGdKa2dlRDQifQ.e...YMV78JdvlH6rb3CTEpy2jJcEIPXRFIdiMUAwRFifN1eKIdtsssD9pKiIAWN-St8bIV0WWDLfT_X5ypFVQ', 'Content-Type': 'application/json'}

    def test_bulk_revoke_admin_can_revoke_any_user(self, api_keys_base_url: str, headers: dict, admin_headers: dict):
        """Test 10: Bulk revoke - admin can bulk revoke any user's keys."""
        if not admin_headers:
            pytest.skip("ADMIN_OC_TOKEN not set")
    
        # Create a key as regular user
        r = requests.post(api_keys_base_url, headers=headers, json={"name": "admin-bulk-revoke-test"}, timeout=30, verify=TLS_VERIFY)
&gt;       assert r.status_code in (200, 201)
E       assert 500 in (200, 201)
E        +  where 500 = &lt;Response [500]&gt;.status_code

test/e2e/tests/test_api_keys.py:353: AssertionError</failure></testcase><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_within_expiration_limit" time="0.032"><failure message="AssertionError: Expected 200/201, got 500: &#10;assert 500 in (200, 201)&#10; +  where 500 = &lt;Response [500]&gt;.status_code">self = &lt;test_api_keys.TestAPIKeyExpiration object at 0x7fc3305d9460&gt;
api_keys_base_url = 'https://maas.apps.16099dc7-4867-446d-a222-ff5afa97b9dc.prod.konfluxeaas.com/maas-api/v1/api-keys'
headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZWRG5TeC1EaUIzTzJkLURKY3p2ZU9sMkhXV2VwQWdBcVFQZGdKa2dlRDQifQ.e...RP_7SAwLkZfHaYBsDYYj0cBxSXVZGJ66UONxuHnoT1E0yz7XBPpXxOm7FAOfkv_vTjoio7VDBt8mjSvLg', 'Content-Type': 'application/json'}
max_expiration_days = 90

    def test_create_key_within_expiration_limit(self, api_keys_base_url: str, headers: dict, max_expiration_days: int):
        """Test: Creating API key with expiration within the limit should succeed."""
    
        # Request expiration at half the limit (e.g., 15 days if limit is 30)
        expires_in_hours = (max_expiration_days // 2) * 24
        if expires_in_hours &lt;= 0:
            expires_in_hours = 24  # At least 1 day
    
        r = requests.post(
            api_keys_base_url,
            headers=headers,
            json={
                "name": "test-within-limit",
                "description": f"Test key with {expires_in_hours}h expiration",
                "expiresIn": f"{expires_in_hours}h"
            },
            timeout=30,
            verify=TLS_VERIFY,
        )
&gt;       assert r.status_code in (200, 201), f"Expected 200/201, got {r.status_code}: {r.text}"
E       AssertionError: Expected 200/201, got 500: 
E       assert 500 in (200, 201)
E        +  where 500 = &lt;Response [500]&gt;.status_code

test/e2e/tests/test_api_keys.py:421: AssertionError</failure></testcase><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_at_expiration_limit" time="0.032"><failure message="AssertionError: Expected 200/201, got 500: &#10;assert 500 in (200, 201)&#10; +  where 500 = &lt;Response [500]&gt;.status_code">self = &lt;test_api_keys.TestAPIKeyExpiration object at 0x7fc3305d31f0&gt;
api_keys_base_url = 'https://maas.apps.16099dc7-4867-446d-a222-ff5afa97b9dc.prod.konfluxeaas.com/maas-api/v1/api-keys'
headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZWRG5TeC1EaUIzTzJkLURKY3p2ZU9sMkhXV2VwQWdBcVFQZGdKa2dlRDQifQ.e...RP_7SAwLkZfHaYBsDYYj0cBxSXVZGJ66UONxuHnoT1E0yz7XBPpXxOm7FAOfkv_vTjoio7VDBt8mjSvLg', 'Content-Type': 'application/json'}
max_expiration_days = 90

    def test_create_key_at_expiration_limit(self, api_keys_base_url: str, headers: dict, max_expiration_days: int):
        """Test: Creating API key with expiration exactly at the limit should succeed."""
    
        # Request expiration exactly at the limit
        expires_in_hours = max_expiration_days * 24
    
        r = requests.post(
            api_keys_base_url,
            headers=headers,
            json={
                "name": "test-at-limit",
                "description": f"Test key with exactly {max_expiration_days} days expiration",
                "expiresIn": f"{expires_in_hours}h"
            },
            timeout=30,
            verify=TLS_VERIFY,
        )
&gt;       assert r.status_code in (200, 201), f"Expected 200/201, got {r.status_code}: {r.text}"
E       AssertionError: Expected 200/201, got 500: 
E       assert 500 in (200, 201)
E        +  where 500 = &lt;Response [500]&gt;.status_code

test/e2e/tests/test_api_keys.py:444: AssertionError</failure></testcase><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_exceeds_expiration_limit" time="0.034"><failure message="AssertionError: Expected 400 for exceeding limit, got 500: &#10;assert 500 == 400&#10; +  where 500 = &lt;Response [500]&gt;.status_code">self = &lt;test_api_keys.TestAPIKeyExpiration object at 0x7fc3305d3a90&gt;
api_keys_base_url = 'https://maas.apps.16099dc7-4867-446d-a222-ff5afa97b9dc.prod.konfluxeaas.com/maas-api/v1/api-keys'
headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZWRG5TeC1EaUIzTzJkLURKY3p2ZU9sMkhXV2VwQWdBcVFQZGdKa2dlRDQifQ.e...RP_7SAwLkZfHaYBsDYYj0cBxSXVZGJ66UONxuHnoT1E0yz7XBPpXxOm7FAOfkv_vTjoio7VDBt8mjSvLg', 'Content-Type': 'application/json'}
max_expiration_days = 90

    def test_create_key_exceeds_expiration_limit(self, api_keys_base_url: str, headers: dict, max_expiration_days: int):
        """Test: Creating API key with expiration exceeding the limit should fail."""
    
        # Request expiration exceeding the limit (e.g., 2x the limit)
        exceeds_days = max_expiration_days * 2
        expires_in_hours = exceeds_days * 24
    
        r = requests.post(
            api_keys_base_url,
            headers=headers,
            json={
                "name": "test-exceeds-limit",
                "description": f"Test key with {exceeds_days} days expiration (exceeds {max_expiration_days} day limit)",
                "expiresIn": f"{expires_in_hours}h"
            },
            timeout=30,
            verify=TLS_VERIFY,
        )
&gt;       assert r.status_code == 400, f"Expected 400 for exceeding limit, got {r.status_code}: {r.text}"
E       AssertionError: Expected 400 for exceeding limit, got 500: 
E       assert 500 == 400
E        +  where 500 = &lt;Response [500]&gt;.status_code

test/e2e/tests/test_api_keys.py:468: AssertionError</failure></testcase></testsuite></testsuites>