Skip to content

Fundamental test coverage of the init_vgrid_script_add_rem helper in vgrid module#428

Draft
jonasbardino wants to merge 2 commits intonextfrom
test/vgrid-init_vgrid_script_add_rem-helper
Draft

Fundamental test coverage of the init_vgrid_script_add_rem helper in vgrid module#428
jonasbardino wants to merge 2 commits intonextfrom
test/vgrid-init_vgrid_script_add_rem-helper

Conversation

@jonasbardino
Copy link
Contributor

@jonasbardino jonasbardino commented Jan 29, 2026

Extend vgrid unit tests to cover the init_vgrid_script_add_rem helper as follow-up to #427 :

  1. Valid parameters as owner
  2. Non-owner attempting modification
  3. Invalid vgrid name format
  4. Missing required subject_type parameter
  5. Invalid subject_type value
  6. Special case allowing members to remove themselves
  7. Special cases allowing removal of participants deleted from site (only with from_remove=True)

There are some TODOs to look into about what I'd consider odd behaviour of the _provision_test_user helper apparently hard-coding only a fixed test user in the user db despite actually provisioning user dirs etc for the provided user DN. This leads to the is_user helper failing to identify anything but the hard-coded test user as a valid user even after provisioning with the helper. As init_vgrid_script_add_rem uses that is_user helper it trickles down into these tests.

1. Valid parameters as owner
2. Non-owner attempting modification
3. Invalid vgrid name format
4. Missing required subject_type parameter
5. Invalid subject_type value
6. Special case allowing members to remove themselves

The tests verify proper validation of:
- VGrid name security checks
- Owner privileges
- Parameter completeness
- Subject type validation
- Special member self-removal case

There are some TODOs to look into about what I'd consider odd behaviour of the
`_provision_test_user` helper apparently hard-coding only a fixed test user in
the user db despite actually provisioning user dirs etc for the provided DN.
This leads to the is_user helper failing to identify anything but the
hard-coded test user as a valid user even after provisioning with the helper.
@jonasbardino jonasbardino added the test-only Improvements or additions solely for better test coverage - without functionality changes label Jan 29, 2026
@jonasbardino jonasbardino self-assigned this Jan 29, 2026
…cover

especially the recently added `from_remove=True` case of #427

The tests ensure that:
- Non-owners cannot remove owners (proper permission check)
- Unknown resources can be added (from_remove=False allows pending ones)
- Unknown resources can be removed (from_remove=True allows non-existing)
- Unknown users cannot be added (from_remove=False refuses non-existing)
- Unknown users can be removed (from_remove=True allows non-existing)
- Non-trigger-owners cannot remove triggers (proper trigger ownership check)
- Trigger owners can remove their triggers (valid removal)
@jonasbardino
Copy link
Contributor Author

I'm unsure if the TODO mentioned in the description here is a bug in _provision_test_user or me not using the helper in the intended way so I've called for your early review before I finish the PR @albu-diku .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-only Improvements or additions solely for better test coverage - without functionality changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant