Commit 8bd287c
test: add coverage for bypass_modes in rulesets (#2802)
Add test coverage for all three bypass_modes (always, pull_request,
exempt) for both repository and organization rulesets.
Repository Ruleset Tests (resource_github_repository_ruleset_test.go):
- Add test for all three bypass_modes with Team actors
- Add test for updating bypass_mode (always → exempt)
- Add test for different actor types with different bypass_modes
(Team/always, RepositoryRole/pull_request, OrganizationAdmin/exempt)
Organization Ruleset Tests (resource_github_organization_ruleset_test.go):
- Fix existing "Creates and updates organization using bypasses" test:
* Move bypass_actors from incorrect location (inside rules) to correct
location (at ruleset level)
* Add missing bypass_mode assertions
* Fix incorrect actor_type assertions (was checking for "0", "5" instead
of actual actor type strings)
* Correct OrganizationAdmin actor_id from 0 to 1
- Add test for all three bypass_modes
- Add test for updating bypass_mode
All tests now verify:
- actor_id (both dynamic Team IDs and static role IDs)
- actor_type (Team, RepositoryRole, OrganizationAdmin, DeployKey)
- bypass_mode (always, pull_request, exempt)
This addresses the review comment from PR #2764 requesting test coverage
for bypass_modes, including the newly added "exempt" mode.
Fixes: #2764 (review)
Co-authored-by: Nick Floyd <[email protected]>1 parent 61a5d02 commit 8bd287c
File tree
2 files changed
+553
-16
lines changed- github
2 files changed
+553
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
306 | 323 | | |
307 | 324 | | |
308 | 325 | | |
| |||
323 | 340 | | |
324 | 341 | | |
325 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
326 | 346 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
331 | 385 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
337 | 406 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
342 | 435 | | |
343 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
344 | 441 | | |
345 | 442 | | |
346 | 443 | | |
347 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
348 | 453 | | |
349 | 454 | | |
350 | | - | |
| 455 | + | |
351 | 456 | | |
352 | 457 | | |
353 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
354 | 463 | | |
355 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
356 | 477 | | |
357 | 478 | | |
358 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
359 | 484 | | |
360 | 485 | | |
361 | 486 | | |
| |||
378 | 503 | | |
379 | 504 | | |
380 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
381 | 578 | | |
0 commit comments