Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StorageBackend: Remove recreate_user from _clear #5772

Merged
merged 1 commit into from
Nov 22, 2022

Commits on Nov 21, 2022

  1. StorageBackend: Remove recreate_user from _clear

    The `_clear` method on the `StorageBackend` deletes all data in the
    storage. This is used by the unit tests when a test requires a clean
    storage to test against. However, the ORM assumes that a `User` instance,
    designated by the profile as the default user, is always present. As
    soon as an ORM entity is stored that requires a user but that is not
    explicitly defined, the default user is retrieved.
    
    When a new profile is configured, the setup command ensures that the
    default user is properly created. However, when the storage is cleared,
    the user is also deleted and so it needs to be recreated. This job had
    been assigned to the `StorageBackend` but really this should not be its
    responsibility. It is specific to the use case of the test cases that
    reset the storage and need to reconstruct the user, so it should take
    care of that.
    
    The `recreate_user` argument is removed from `StorageBackend._clear` and
    the logic to recreate a user after storage reset is moved to the
    `ProfileManager`. The `clear_profile` method, which calls the storage
    clear, recreates the user at the end. The `TemporaryProfileManager`,
    which subclasses the `ProfileManager` does the same when a temporary
    test profile is created at the start of a test session.
    sphuber committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    20a312e View commit details
    Browse the repository at this point in the history