Skip to content

Commit 0bd6cf8

Browse files
authored
fix: export missing types and update event tests (#631)
1 parent f35fb92 commit 0bd6cf8

15 files changed

Lines changed: 153 additions & 71 deletions

.oagen-manifest.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": 1,
2+
"version": 2,
33
"language": "python",
4-
"generatedAt": "2026-04-22T22:10:13.399Z",
4+
"generatedAt": "2026-04-23T15:27:42.321Z",
55
"files": [
66
"src/workos/_client.py",
77
"src/workos/admin_portal/__init__.py",
@@ -814,6 +814,7 @@
814814
"tests/fixtures/event_context_actor.json",
815815
"tests/fixtures/event_context_google_analytics_session.json",
816816
"tests/fixtures/event_list_list_metadata.json",
817+
"tests/fixtures/event_schema.json",
817818
"tests/fixtures/external_auth_complete_response.json",
818819
"tests/fixtures/feature_flag.json",
819820
"tests/fixtures/feature_flag_owner.json",
@@ -884,6 +885,7 @@
884885
"tests/fixtures/list_directory.json",
885886
"tests/fixtures/list_directory_group.json",
886887
"tests/fixtures/list_directory_user_with_groups.json",
888+
"tests/fixtures/list_event_schema.json",
887889
"tests/fixtures/list_flag.json",
888890
"tests/fixtures/list_organization.json",
889891
"tests/fixtures/list_role_assignment.json",
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# This file is auto-generated by oagen. Do not edit.
22

3-
from ._resource import Authorization, AsyncAuthorization
3+
from ._resource import (
4+
Authorization,
5+
AsyncAuthorization,
6+
ResourceTargetById,
7+
ResourceTargetByExternalId,
8+
ParentResourceById,
9+
ParentResourceByExternalId,
10+
ParentById,
11+
ParentByExternalId,
12+
)
413
from .models import *
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# This file is auto-generated by oagen. Do not edit.
22

3-
from ._resource import UserManagement, AsyncUserManagement
3+
from ._resource import (
4+
UserManagement,
5+
AsyncUserManagement,
6+
PasswordPlaintext,
7+
PasswordHashed,
8+
RoleSingle,
9+
RoleMultiple,
10+
)
411
from .models import *

tests/test_api_keys.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from tests.generated_helpers import load_fixture
88

99
from workos.api_keys.models import (
10+
ApiKey,
1011
ApiKeyValidationResponse,
1112
ApiKeyWithValue,
1213
OrganizationsApiKeysOrder,
@@ -49,7 +50,8 @@ def test_list_organization_api_keys(self, workos, httpx_mock):
4950
)
5051
page = workos.api_keys.list_organization_api_keys("test_organizationId")
5152
assert isinstance(page, SyncPage)
52-
assert isinstance(page.data, list)
53+
assert len(page.data) == 1
54+
assert isinstance(page.data[0], ApiKey)
5355

5456
def test_list_organization_api_keys_empty_page(self, workos, httpx_mock):
5557
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -190,7 +192,8 @@ async def test_list_organization_api_keys(self, async_workos, httpx_mock):
190192
"test_organizationId"
191193
)
192194
assert isinstance(page, AsyncPage)
193-
assert isinstance(page.data, list)
195+
assert len(page.data) == 1
196+
assert isinstance(page.data[0], ApiKey)
194197

195198
@pytest.mark.asyncio
196199
async def test_list_organization_api_keys_empty_page(

tests/test_audit_logs.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from tests.generated_helpers import load_fixture
88

99
from workos.audit_logs.models import (
10+
AuditLogActionJson,
1011
AuditLogEvent,
1112
AuditLogEventCreateResponse,
1213
AuditLogExportJson,
@@ -58,7 +59,8 @@ def test_list_actions(self, workos, httpx_mock):
5859
)
5960
page = workos.audit_logs.list_actions()
6061
assert isinstance(page, SyncPage)
61-
assert isinstance(page.data, list)
62+
assert len(page.data) == 1
63+
assert isinstance(page.data[0], AuditLogActionJson)
6264

6365
def test_list_actions_empty_page(self, workos, httpx_mock):
6466
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -86,7 +88,8 @@ def test_list_action_schemas(self, workos, httpx_mock):
8688
)
8789
page = workos.audit_logs.list_action_schemas("test_actionName")
8890
assert isinstance(page, SyncPage)
89-
assert isinstance(page.data, list)
91+
assert len(page.data) == 1
92+
assert isinstance(page.data[0], AuditLogSchemaJson)
9093

9194
def test_list_action_schemas_empty_page(self, workos, httpx_mock):
9295
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -286,7 +289,8 @@ async def test_list_actions(self, async_workos, httpx_mock):
286289
httpx_mock.add_response(json=load_fixture("list_audit_log_action_json.json"))
287290
page = await async_workos.audit_logs.list_actions()
288291
assert isinstance(page, AsyncPage)
289-
assert isinstance(page.data, list)
292+
assert len(page.data) == 1
293+
assert isinstance(page.data[0], AuditLogActionJson)
290294

291295
@pytest.mark.asyncio
292296
async def test_list_actions_empty_page(self, async_workos, httpx_mock):
@@ -315,7 +319,8 @@ async def test_list_action_schemas(self, async_workos, httpx_mock):
315319
httpx_mock.add_response(json=load_fixture("list_audit_log_schema_json.json"))
316320
page = await async_workos.audit_logs.list_action_schemas("test_actionName")
317321
assert isinstance(page, AsyncPage)
318-
assert isinstance(page.data, list)
322+
assert len(page.data) == 1
323+
assert isinstance(page.data[0], AuditLogSchemaJson)
319324

320325
@pytest.mark.asyncio
321326
async def test_list_action_schemas_empty_page(self, async_workos, httpx_mock):

tests/test_authorization.py

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Role,
1515
RoleAssignment,
1616
RoleList,
17+
UserOrganizationMembershipBaseListData,
1718
AuthorizationAssignment,
1819
AuthorizationOrder,
1920
PermissionsOrder,
@@ -64,7 +65,8 @@ def test_list_organization_membership_resources(self, workos, httpx_mock):
6465
permission_slug="test_permission_slug",
6566
)
6667
assert isinstance(page, SyncPage)
67-
assert isinstance(page.data, list)
68+
assert len(page.data) == 1
69+
assert isinstance(page.data[0], AuthorizationResource)
6870

6971
def test_list_organization_membership_resources_empty_page(
7072
self, workos, httpx_mock
@@ -111,7 +113,8 @@ def test_list_resource_permissions(self, workos, httpx_mock):
111113
"test_organization_membership_id", "test_resource_id"
112114
)
113115
assert isinstance(page, SyncPage)
114-
assert isinstance(page.data, list)
116+
assert len(page.data) == 1
117+
assert isinstance(page.data[0], AuthorizationPermission)
115118

116119
def test_list_resource_permissions_empty_page(self, workos, httpx_mock):
117120
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -147,7 +150,8 @@ def test_list_effective_permissions_by_external_id(self, workos, httpx_mock):
147150
"test_external_id",
148151
)
149152
assert isinstance(page, SyncPage)
150-
assert isinstance(page.data, list)
153+
assert len(page.data) == 1
154+
assert isinstance(page.data[0], AuthorizationPermission)
151155

152156
def test_list_effective_permissions_by_external_id_empty_page(
153157
self, workos, httpx_mock
@@ -188,7 +192,8 @@ def test_list_organization_membership_role_assignments(self, workos, httpx_mock)
188192
"test_organization_membership_id"
189193
)
190194
assert isinstance(page, SyncPage)
191-
assert isinstance(page.data, list)
195+
assert len(page.data) == 1
196+
assert isinstance(page.data[0], RoleAssignment)
192197

193198
def test_list_organization_membership_role_assignments_empty_page(
194199
self, workos, httpx_mock
@@ -457,7 +462,8 @@ def test_list_resource_organization_memberships(self, workos, httpx_mock):
457462
permission_slug="test_permission_slug",
458463
)
459464
assert isinstance(page, SyncPage)
460-
assert isinstance(page.data, list)
465+
assert len(page.data) == 1
466+
assert isinstance(page.data[0], UserOrganizationMembershipBaseListData)
461467

462468
def test_list_resource_organization_memberships_empty_page(
463469
self, workos, httpx_mock
@@ -503,7 +509,8 @@ def test_list_resources(self, workos, httpx_mock):
503509
parent=ParentById(parent_resource_id="test_value")
504510
)
505511
assert isinstance(page, SyncPage)
506-
assert isinstance(page.data, list)
512+
assert len(page.data) == 1
513+
assert isinstance(page.data[0], AuthorizationResource)
507514

508515
def test_list_resources_empty_page(self, workos, httpx_mock):
509516
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -611,7 +618,8 @@ def test_list_memberships_for_resource(self, workos, httpx_mock):
611618
"test_resource_id", permission_slug="test_permission_slug"
612619
)
613620
assert isinstance(page, SyncPage)
614-
assert isinstance(page.data, list)
621+
assert len(page.data) == 1
622+
assert isinstance(page.data[0], UserOrganizationMembershipBaseListData)
615623

616624
def test_list_memberships_for_resource_empty_page(self, workos, httpx_mock):
617625
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -732,7 +740,8 @@ def test_list_permissions(self, workos, httpx_mock):
732740
)
733741
page = workos.authorization.list_permissions()
734742
assert isinstance(page, SyncPage)
735-
assert isinstance(page.data, list)
743+
assert len(page.data) == 1
744+
assert isinstance(page.data[0], AuthorizationPermission)
736745

737746
def test_list_permissions_empty_page(self, workos, httpx_mock):
738747
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -934,7 +943,8 @@ async def test_list_organization_membership_resources(
934943
permission_slug="test_permission_slug",
935944
)
936945
assert isinstance(page, AsyncPage)
937-
assert isinstance(page.data, list)
946+
assert len(page.data) == 1
947+
assert isinstance(page.data[0], AuthorizationResource)
938948

939949
@pytest.mark.asyncio
940950
async def test_list_organization_membership_resources_empty_page(
@@ -982,7 +992,8 @@ async def test_list_resource_permissions(self, async_workos, httpx_mock):
982992
"test_organization_membership_id", "test_resource_id"
983993
)
984994
assert isinstance(page, AsyncPage)
985-
assert isinstance(page.data, list)
995+
assert len(page.data) == 1
996+
assert isinstance(page.data[0], AuthorizationPermission)
986997

987998
@pytest.mark.asyncio
988999
async def test_list_resource_permissions_empty_page(self, async_workos, httpx_mock):
@@ -1025,7 +1036,8 @@ async def test_list_effective_permissions_by_external_id(
10251036
)
10261037
)
10271038
assert isinstance(page, AsyncPage)
1028-
assert isinstance(page.data, list)
1039+
assert len(page.data) == 1
1040+
assert isinstance(page.data[0], AuthorizationPermission)
10291041

10301042
@pytest.mark.asyncio
10311043
async def test_list_effective_permissions_by_external_id_empty_page(
@@ -1071,7 +1083,8 @@ async def test_list_organization_membership_role_assignments(
10711083
"test_organization_membership_id"
10721084
)
10731085
assert isinstance(page, AsyncPage)
1074-
assert isinstance(page.data, list)
1086+
assert len(page.data) == 1
1087+
assert isinstance(page.data[0], RoleAssignment)
10751088

10761089
@pytest.mark.asyncio
10771090
async def test_list_organization_membership_role_assignments_empty_page(
@@ -1338,7 +1351,8 @@ async def test_list_resource_organization_memberships(
13381351
permission_slug="test_permission_slug",
13391352
)
13401353
assert isinstance(page, AsyncPage)
1341-
assert isinstance(page.data, list)
1354+
assert len(page.data) == 1
1355+
assert isinstance(page.data[0], UserOrganizationMembershipBaseListData)
13421356

13431357
@pytest.mark.asyncio
13441358
async def test_list_resource_organization_memberships_empty_page(
@@ -1385,7 +1399,8 @@ async def test_list_resources(self, async_workos, httpx_mock):
13851399
parent=ParentById(parent_resource_id="test_value")
13861400
)
13871401
assert isinstance(page, AsyncPage)
1388-
assert isinstance(page.data, list)
1402+
assert len(page.data) == 1
1403+
assert isinstance(page.data[0], AuthorizationResource)
13891404

13901405
@pytest.mark.asyncio
13911406
async def test_list_resources_empty_page(self, async_workos, httpx_mock):
@@ -1492,7 +1507,8 @@ async def test_list_memberships_for_resource(self, async_workos, httpx_mock):
14921507
"test_resource_id", permission_slug="test_permission_slug"
14931508
)
14941509
assert isinstance(page, AsyncPage)
1495-
assert isinstance(page.data, list)
1510+
assert len(page.data) == 1
1511+
assert isinstance(page.data[0], UserOrganizationMembershipBaseListData)
14961512

14971513
@pytest.mark.asyncio
14981514
async def test_list_memberships_for_resource_empty_page(
@@ -1603,7 +1619,8 @@ async def test_list_permissions(self, async_workos, httpx_mock):
16031619
httpx_mock.add_response(json=load_fixture("list_authorization_permission.json"))
16041620
page = await async_workos.authorization.list_permissions()
16051621
assert isinstance(page, AsyncPage)
1606-
assert isinstance(page.data, list)
1622+
assert len(page.data) == 1
1623+
assert isinstance(page.data[0], AuthorizationPermission)
16071624

16081625
@pytest.mark.asyncio
16091626
async def test_list_permissions_empty_page(self, async_workos, httpx_mock):

tests/test_connect.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def test_list_applications(self, workos, httpx_mock):
5252
)
5353
page = workos.connect.list_applications()
5454
assert isinstance(page, SyncPage)
55-
assert isinstance(page.data, list)
55+
assert len(page.data) == 1
56+
assert isinstance(page.data[0], ConnectApplication)
5657

5758
def test_list_applications_empty_page(self, workos, httpx_mock):
5859
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -295,7 +296,8 @@ async def test_list_applications(self, async_workos, httpx_mock):
295296
httpx_mock.add_response(json=load_fixture("list_connect_application.json"))
296297
page = await async_workos.connect.list_applications()
297298
assert isinstance(page, AsyncPage)
298-
assert isinstance(page.data, list)
299+
assert len(page.data) == 1
300+
assert isinstance(page.data[0], ConnectApplication)
299301

300302
@pytest.mark.asyncio
301303
async def test_list_applications_empty_page(self, async_workos, httpx_mock):

tests/test_directory_sync.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def test_list_directories(self, workos, httpx_mock):
3131
)
3232
page = workos.directory_sync.list_directories()
3333
assert isinstance(page, SyncPage)
34-
assert isinstance(page.data, list)
34+
assert len(page.data) == 1
35+
assert isinstance(page.data[0], Directory)
3536

3637
def test_list_directories_empty_page(self, workos, httpx_mock):
3738
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -85,7 +86,8 @@ def test_list_groups(self, workos, httpx_mock):
8586
)
8687
page = workos.directory_sync.list_groups()
8788
assert isinstance(page, SyncPage)
88-
assert isinstance(page.data, list)
89+
assert len(page.data) == 1
90+
assert isinstance(page.data[0], DirectoryGroup)
8991

9092
def test_list_groups_empty_page(self, workos, httpx_mock):
9193
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -129,7 +131,8 @@ def test_list_users(self, workos, httpx_mock):
129131
)
130132
page = workos.directory_sync.list_users()
131133
assert isinstance(page, SyncPage)
132-
assert isinstance(page.data, list)
134+
assert len(page.data) == 1
135+
assert isinstance(page.data[0], DirectoryUserWithGroups)
133136

134137
def test_list_users_empty_page(self, workos, httpx_mock):
135138
httpx_mock.add_response(json={"data": [], "list_metadata": {}})
@@ -249,7 +252,8 @@ async def test_list_directories(self, async_workos, httpx_mock):
249252
httpx_mock.add_response(json=load_fixture("list_directory.json"))
250253
page = await async_workos.directory_sync.list_directories()
251254
assert isinstance(page, AsyncPage)
252-
assert isinstance(page.data, list)
255+
assert len(page.data) == 1
256+
assert isinstance(page.data[0], Directory)
253257

254258
@pytest.mark.asyncio
255259
async def test_list_directories_empty_page(self, async_workos, httpx_mock):
@@ -306,7 +310,8 @@ async def test_list_groups(self, async_workos, httpx_mock):
306310
httpx_mock.add_response(json=load_fixture("list_directory_group.json"))
307311
page = await async_workos.directory_sync.list_groups()
308312
assert isinstance(page, AsyncPage)
309-
assert isinstance(page.data, list)
313+
assert len(page.data) == 1
314+
assert isinstance(page.data[0], DirectoryGroup)
310315

311316
@pytest.mark.asyncio
312317
async def test_list_groups_empty_page(self, async_workos, httpx_mock):
@@ -352,7 +357,8 @@ async def test_list_users(self, async_workos, httpx_mock):
352357
)
353358
page = await async_workos.directory_sync.list_users()
354359
assert isinstance(page, AsyncPage)
355-
assert isinstance(page.data, list)
360+
assert len(page.data) == 1
361+
assert isinstance(page.data[0], DirectoryUserWithGroups)
356362

357363
@pytest.mark.asyncio
358364
async def test_list_users_empty_page(self, async_workos, httpx_mock):

0 commit comments

Comments
 (0)