@@ -42,17 +42,23 @@ def test_create_resource_required_fields_only(
4242
4343 resource = syncify (
4444 self .authorization .create_resource (
45- resource_type = "document" ,
45+ resource_type_slug = "document" ,
4646 organization_id = "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
47+ external_id = "ext_123" ,
48+ name = "Test Resource" ,
49+ parent = {"parent_resource_id" : "res_01PARENT" },
4750 )
4851 )
4952
5053 assert resource .id == "res_01ABC"
5154 assert request_kwargs ["method" ] == "post"
5255 assert request_kwargs ["url" ].endswith ("/authorization/resources" )
5356 assert request_kwargs ["json" ] == {
54- "resource_type " : "document" ,
57+ "resource_type_slug " : "document" ,
5558 "organization_id" : "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
59+ "external_id" : "ext_123" ,
60+ "name" : "Test Resource" ,
61+ "parent_resource_id" : "res_01PARENT" ,
5662 }
5763
5864 def test_create_resource_with_all_optional_fields (
@@ -64,20 +70,22 @@ def test_create_resource_with_all_optional_fields(
6470
6571 syncify (
6672 self .authorization .create_resource (
67- resource_type = "document" ,
73+ resource_type_slug = "document" ,
6874 organization_id = "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
6975 external_id = "ext_123" ,
70- meta = {"key" : "value" },
71- parent = {"resource_id" : "res_01PARENT" },
76+ name = "Test Resource" ,
77+ parent = {"parent_resource_id" : "res_01PARENT" },
78+ description = "A test document" ,
7279 )
7380 )
7481
7582 assert request_kwargs ["json" ] == {
76- "resource_type " : "document" ,
83+ "resource_type_slug " : "document" ,
7784 "organization_id" : "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
7885 "external_id" : "ext_123" ,
79- "meta" : {"key" : "value" },
80- "parent" : {"resource_id" : "res_01PARENT" },
86+ "name" : "Test Resource" ,
87+ "parent_resource_id" : "res_01PARENT" ,
88+ "description" : "A test document" ,
8189 }
8290
8391 def test_create_resource_with_parent_by_id (
@@ -89,13 +97,15 @@ def test_create_resource_with_parent_by_id(
8997
9098 syncify (
9199 self .authorization .create_resource (
92- resource_type = "document" ,
100+ resource_type_slug = "document" ,
93101 organization_id = "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
94- parent = {"resource_id" : "res_01PARENT" },
102+ external_id = "ext_123" ,
103+ name = "Test Resource" ,
104+ parent = {"parent_resource_id" : "res_01PARENT" },
95105 )
96106 )
97107
98- assert request_kwargs ["json" ]["parent " ] == { "resource_id" : " res_01PARENT"}
108+ assert request_kwargs ["json" ]["parent_resource_id " ] == " res_01PARENT"
99109
100110 def test_create_resource_with_parent_by_external_id (
101111 self , mock_resource , capture_and_mock_http_client_request
@@ -106,21 +116,19 @@ def test_create_resource_with_parent_by_external_id(
106116
107117 syncify (
108118 self .authorization .create_resource (
109- resource_type = "document" ,
119+ resource_type_slug = "document" ,
110120 organization_id = "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
121+ external_id = "ext_123" ,
122+ name = "Test Resource" ,
111123 parent = {
112- "organization_id" : "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
113- "resource_type" : "folder" ,
114- "external_id" : "ext_parent_456" ,
124+ "parent_resource_external_id" : "ext_parent_456" ,
125+ "parent_resource_type_slug" : "folder" ,
115126 },
116127 )
117128 )
118129
119- assert request_kwargs ["json" ]["parent" ] == {
120- "organization_id" : "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
121- "resource_type" : "folder" ,
122- "external_id" : "ext_parent_456" ,
123- }
130+ assert request_kwargs ["json" ]["parent_resource_external_id" ] == "ext_parent_456"
131+ assert request_kwargs ["json" ]["parent_resource_type_slug" ] == "folder"
124132
125133 # --- update_resource ---
126134
@@ -134,14 +142,18 @@ def test_update_resource_with_meta(
134142 resource = syncify (
135143 self .authorization .update_resource (
136144 "res_01ABC" ,
137- meta = {"updated_key" : "updated_value" },
145+ name = "Updated Name" ,
146+ description = "Updated description" ,
138147 )
139148 )
140149
141150 assert resource .id == "res_01ABC"
142151 assert request_kwargs ["method" ] == "patch"
143152 assert request_kwargs ["url" ].endswith ("/authorization/resources/res_01ABC" )
144- assert request_kwargs ["json" ] == {"meta" : {"updated_key" : "updated_value" }}
153+ assert request_kwargs ["json" ] == {
154+ "name" : "Updated Name" ,
155+ "description" : "Updated description" ,
156+ }
145157
146158 def test_update_resource_without_meta (
147159 self , mock_resource , capture_and_mock_http_client_request
0 commit comments