Skip to content

Conversation

Copy link

Copilot AI commented Jan 22, 2026

The ProfileForm.__init__ method conditionally removes storage-related fields based on WEKO_RECORDS_UI_USER_STORAGE_MODIFICATION_ENABLED config flag, but lacked test coverage.

Changes

  • Added test_init_storage_fields_removed_when_disabled to verify fields (access_key, secret_key, s3_endpoint_url, s3_region_name) are removed when flag is False
  • Added test_init_storage_fields_present_when_enabled to verify fields are present when flag is True

Tests follow existing TestProfileForm patterns and use the app fixture for proper context management.

def test_init_storage_fields_removed_when_disabled(self, app):
    """Test that storage fields are removed when feature flag is disabled."""
    app.config.update(
        WEKO_RECORDS_UI_USER_STORAGE_MODIFICATION_ENABLED=False
    )
    
    with app.app_context():
        form = ProfileForm()
        
        assert not hasattr(form, 'access_key')
        assert not hasattr(form, 'secret_key')
        assert not hasattr(form, 's3_endpoint_url')
        assert not hasattr(form, 's3_region_name')

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 22, 2026 08:03
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Copilot AI changed the title [WIP] Work in progress to address feedback on storage function Add test coverage for ProfileForm storage field conditional removal Jan 22, 2026
Copilot AI requested a review from mhaya January 22, 2026 08:06
@mhaya mhaya marked this pull request as ready for review January 22, 2026 08:47
@mhaya mhaya merged commit b5bcc68 into fix/issue57294 Jan 22, 2026
13 of 90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants