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

Bugfix: Use custom workspace form when cloning #538

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

amstilp
Copy link
Contributor

@amstilp amstilp commented Nov 13, 2024

  • Change the WorkspaceCloneForm to a mixin that can be combined with another form
  • Modify the WorkspaceClone view to create a custom class for a workspace clone form by using the workspace form specified in the adapter and the WorkspaceCloneFormMixin
  • Add some tests to check correct behavior

Closes #516

Previously, the app defined a separate form to use in the WorkspaceClone
view. If a user specified a custom workspace form in the adapter,
the WorkspaceClone view would ignore that custom form when creating
a new workspace of that type, so any custom cleaning was lost. Fix
this by changing the WorkspaceCloneForm to a mixin and defining a
new form class on the fly in the WorkspaceClone view. This new class
subclasses the workspace form specified by the adapter as well as the
WorkspaceCloneFormMixin.
This test checks that the custom workspace form is used to create
the form for cloning the workspace, by checking that the validation
on the form runs correctly. (The test form defines a clean method
for the workspace name.)
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.74%. Comparing base (cd28592) to head (bcf26a5).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #538   +/-   ##
=======================================
  Coverage   99.74%   99.74%           
=======================================
  Files         135      135           
  Lines       24197    24265   +68     
=======================================
+ Hits        24135    24203   +68     
  Misses         62       62           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Move the authorization domain validation to the clean method, instead
of having a separate clean_authorization_domains method. This is likely
better for inheritance, because people could add their own method for
clean_authorization_domains and would be less likely to call the
super() method. Forms typically should call the super().clean method
in their clean method, and it is shown in django docs, so that is a
better place to add the custom auth domain checks.
@amstilp amstilp merged commit d2ddcbe into main Nov 13, 2024
13 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.

Cloning a workspace does not use the workspace form specified in the adapter
1 participant