Commit 354b338
fix: handle async client in add_organizer() no-arg path
add_organizer() without arguments called self.client.principal()
directly. On an AsyncDAVClient that method is a coroutine function, so
the call returned a coroutine object and the subsequent .get_vcal_address()
raised AttributeError. Fix by delegating to _async_add_organizer() when
is_async_client, following the same dual-mode pattern used by set_relation()
and load(). Extract _set_organizer() to avoid duplicating the two-liner
that pops and re-adds the ORGANIZER property.
Add _async_get_vcal_address() to Principal so that _async_add_organizer()
can await the property lookups (get_display_name, calendar-user-address-set,
CalendarUserType) that get_vcal_address() performs synchronously.
Also add missing unit tests:
- test_add_organizer_principal_object: cover the Principal-object argument
path (isinstance(organizer, _Principal)), which had no coverage.
- test_add_organizer_explicit_arg_is_sync_safe_for_async_client: explicit
arg is pure in-memory and must not require awaiting even for async clients.
- test_add_organizer_no_arg_returns_coroutine_for_async_client: the no-arg
path must return a coroutine (not raise AttributeError) for async clients.
- test_add_organizer_no_arg_async_awaited_sets_organizer: awaiting that
coroutine must actually set the ORGANIZER field.
Add sync integration test testAddOrganizer to RepeatedFunctionalTestsBaseClass
covering all three argument forms (no-arg, email string, vCalAddress). The
no-arg sub-test is skipped on servers that do not expose
scheduling.calendar-user-address-set.
Add async integration test test_add_organizer_no_arg to
AsyncFunctionalTestsBaseClass in tests/test_async_integration.py. It
verifies that add_organizer() returns a coroutine for async clients, that
awaiting it sets ORGANIZER, and that the resulting address matches the
principal's own vCalAddress. Also skipped when
scheduling.calendar-user-address-set is not supported.
Note: the two callers that invoke add_organizer() without arguments
(Calendar.freebusy_request and Calendar.save_with_invites in collection.py)
are not themselves async-aware, so they will still malfunction when used
via an async client — but that is a pre-existing limitation of those methods,
not something introduced here.
Prompt: The new logic in add_organizer, is it well-enough covered by test
code? Is there a symmetry in the async and sync behaviour? Is there a
symmetry between the sync and async tests? Fix the missing tests, including
async tests and particularly a test to expose the async bug. Come with
suggestions on how to solve the async problem.
Followup-prompt: In the previous commit a fix was applied, but the commit
message says that only the test framework was modified. Please amend the
commit.
Followup-prompt: The previous commit did not add any integration tests.
Please add some integration tests (including async tests) and amend the
commit.
Followup-prompt: Keep the commit message in imperative mood.
Followup-prompt: Async tests should be in tests/test_async_integration.py.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 916ef6d commit 354b338
File tree
5 files changed
+179
-1
lines changed- caldav
- tests
5 files changed
+179
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
| 195 | + | |
| 196 | + | |
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
| |||
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
204 | 219 | | |
205 | 220 | | |
206 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
399 | 415 | | |
400 | 416 | | |
401 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
442 | 473 | | |
443 | 474 | | |
444 | 475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1263 | 1263 | | |
1264 | 1264 | | |
1265 | 1265 | | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
1266 | 1306 | | |
1267 | 1307 | | |
1268 | 1308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2190 | 2190 | | |
2191 | 2191 | | |
2192 | 2192 | | |
2193 | | - | |
| 2193 | + | |
2194 | 2194 | | |
2195 | 2195 | | |
2196 | 2196 | | |
2197 | 2197 | | |
2198 | 2198 | | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
2199 | 2263 | | |
2200 | 2264 | | |
2201 | 2265 | | |
| |||
2867 | 2931 | | |
2868 | 2932 | | |
2869 | 2933 | | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
2870 | 2946 | | |
2871 | 2947 | | |
2872 | 2948 | | |
| |||
0 commit comments