File tree Expand file tree Collapse file tree
sdk/python/tests/unit/badge Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55import base64
66import json
7- from unittest .mock import AsyncMock , patch
7+ from unittest .mock import AsyncMock , patch , mock_open
88
99import pytest
1010
@@ -59,6 +59,24 @@ async def test_create_claims_for_a2a_agent():
5959 assert "a2a" in claims
6060 assert claims ["a2a" ]["schema_base64" ] == expected_schema
6161
62+ @pytest .mark .asyncio
63+ async def test_create_claims_for_oasf_agent ():
64+ """Test create_claims for OASF agent."""
65+ # Arrange
66+ service_url = "/path/to/oasf.json"
67+ service_type = AppType .APP_TYPE_AGENT_OASF
68+ oasf_schema = json .dumps ({"version" : "1.0.0" , "name" : "Test OASF Agent" })
69+ expected_schema = base64 .b64encode (oasf_schema .encode ("utf-8" ))
70+
71+ # Act
72+ m = mock_open (read_data = oasf_schema )
73+ with patch ("builtins.open" , m ):
74+ claims = await create_claims (service_url , "" , service_type )
75+
76+ # Assert
77+ m .assert_called_once_with (service_url , "r" , encoding = "utf-8" )
78+ assert "oasf" in claims
79+ assert claims ["oasf" ]["schema_base64" ] == expected_schema
6280
6381@pytest .mark .asyncio
6482async def test_create_claims_for_unsupported_service_type ():
You can’t perform that action at this time.
0 commit comments