fix: export missing types and update event tests#631
Conversation
Types like ResourceTargetById, PasswordPlaintext, and others were defined in _resource.py but not re-exported from the package __init__.py, making them inaccessible when importing from the top-level module.
Tests were using inline JSON and importing ActionAuthenticationDenied which is no longer needed. Switch to the list_event_schema fixture and add empty page test cases for both sync and async clients.
Greptile SummaryThis PR fixes missing public exports in Confidence Score: 5/5This PR is safe to merge — all exported types are confirmed to exist in source, and test improvements are straightforward. All type exports are verified against the actual _resource.py definitions. Test changes replace weak isinstance(list) checks with concrete type assertions, strictly improving coverage. No logic changes, no security impact, no breaking changes. No files require special attention. Important Files Changed
Class Diagram%%{init: {'theme': 'neutral'}}%%
classDiagram
namespace workos_authorization {
class Authorization
class AsyncAuthorization
class ResourceTargetById {
+resource_id: str
}
class ResourceTargetByExternalId {
+external_id: str
}
class ParentResourceById {
+parent_resource_id: str
}
class ParentResourceByExternalId {
+external_id: str
}
class ParentById {
+parent_resource_id: str
}
class ParentByExternalId {
+external_id: str
}
}
namespace workos_user_management {
class UserManagement
class AsyncUserManagement
class PasswordPlaintext {
+password: str
}
class PasswordHashed {
+password_hash: str
+hash_type: str
}
class RoleSingle {
+role: str
}
class RoleMultiple {
+roles: list
}
}
Authorization ..> ResourceTargetById : uses
Authorization ..> ResourceTargetByExternalId : uses
Authorization ..> ParentById : uses
Authorization ..> ParentByExternalId : uses
UserManagement ..> PasswordPlaintext : uses
UserManagement ..> PasswordHashed : uses
UserManagement ..> RoleSingle : uses
UserManagement ..> RoleMultiple : uses
Reviews (2): Last reviewed commit: "test: strengthen paginated list assertio..." | Re-trigger Greptile |
The generated tests only verified `page.data` was a list, which passes even when deserialization silently returns raw dicts. Asserting `len` and `isinstance` on the first element catches type-mapping regressions at the fixture level.
Summary
ResourceTargetById,ResourceTargetByExternalId,ParentResourceById,ParentResourceByExternalId,ParentById,ParentByExternalId) fromworkos.authorizationPasswordPlaintext,PasswordHashed,RoleSingle,RoleMultiple) fromworkos.user_managementlist_event_schemafixture instead of inline JSON withActionAuthenticationDeniedTest plan
uv run pytest tests/test_events.pypassesfrom workos.authorization import ResourceTargetByIdfrom workos.user_management import PasswordPlaintextuv run pyrightpasses with no new errors