1- """Mock fixture for AuthorizationResource used in testing new FGA APIs.
2-
3- This fixture represents the new organization-scoped authorization resource model
4- used in the Advanced FGA APIs, distinct from the legacy warrant-based resources.
5- """
6-
71from typing import Optional
82
3+ from workos .types .authorization .authorization_resource import AuthorizationResource
94
10- class MockAuthorizationResource :
11- """Mock authorization resource for testing the new FGA resource-based APIs.
12-
13- Attributes:
14- id: Internal WorkOS resource ID.
15- external_id: Customer-provided external identifier for the resource.
16- name: Human-readable name for the resource.
17- description: Optional description of the resource.
18- resource_type_slug: The type of resource (e.g., "document", "folder").
19- organization_id: The organization this resource belongs to.
20- parent_resource_id: Optional parent resource ID for hierarchical resources.
21- """
225
6+ class MockAuthorizationResource (AuthorizationResource ):
237 def __init__ (
248 self ,
259 id : str = "authz_resource_01HXYZ123ABC456DEF789ABC" ,
@@ -30,25 +14,15 @@ def __init__(
3014 organization_id : str = "org_01HXYZ123ABC456DEF789ABC" ,
3115 parent_resource_id : Optional [str ] = None ,
3216 ):
33- self .id = id
34- self .external_id = external_id
35- self .name = name
36- self .description = description
37- self .resource_type_slug = resource_type_slug
38- self .organization_id = organization_id
39- self .parent_resource_id = parent_resource_id
40-
41- def dict (self ) -> dict :
42- """Return the resource as a dictionary matching API response format."""
43- return {
44- "object" : "authorization_resource" ,
45- "id" : self .id ,
46- "external_id" : self .external_id ,
47- "name" : self .name ,
48- "description" : self .description ,
49- "resource_type_slug" : self .resource_type_slug ,
50- "organization_id" : self .organization_id ,
51- "parent_resource_id" : self .parent_resource_id ,
52- "created_at" : "2024-01-15T09:30:00.000Z" ,
53- "updated_at" : "2024-01-15T09:30:00.000Z" ,
54- }
17+ super ().__init__ (
18+ object = "authorization_resource" ,
19+ id = id ,
20+ external_id = external_id ,
21+ name = name ,
22+ description = description ,
23+ resource_type_slug = resource_type_slug ,
24+ organization_id = organization_id ,
25+ parent_resource_id = parent_resource_id ,
26+ created_at = "2024-01-15T09:30:00.000Z" ,
27+ updated_at = "2024-01-15T09:30:00.000Z" ,
28+ )
0 commit comments