-
Notifications
You must be signed in to change notification settings - Fork 20
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
Counter part for Avoid purging Revisions #10678 #53
Comments
I'll be opening PR for this by today itself. |
Hi @disconnect821, thanks for raising this as an issue first. Changing the ForeignKey from When you make this change, could you please also add a test that proves Regarding the above reference to 'basing your work on my branch' I recommend you take the following steps:
Thanks again for wanting to work on this! ❤️ |
Thanks @Stormheg, I'm on it. |
@Stormheg Can you provide me some tips for writing tests as I'm not very experienced with tests? |
@disconnect821 you can try something like this from django.db.models.deletion import ProtectedError
def test_check_raise_protect_error(self):
"""
Test to check if ProtectedError is raised when associated revision is deleted
"""
with self.assertRaises(ProtectedError):
self.revision.delete() Also @Stormheg could you let me have some insights of how to set-up the dependencies for this repo and runtests? |
@salty-ivy running the tests is not that well documented in the readme, here is how I did it. Assuming you are inside a virtualenv # Install wagtail-ab-testing in editable mode along with its testing dependencies
pip install -e ".[testing]"
# Run the tests
python testmanage.py test |
@disconnect821 If you need some general information on how to write tests I recommend part 5 of the Django tutorial: https://docs.djangoproject.com/en/4.2/intro/tutorial05/. salty-ivy provided you with an example on how to check if a specific type of exception is raised. Thank you Aman Pandey! In my earlier comment I outlined what I would expect you to test. I hope this gives you enough guidance on what to do. It is up to you to research and gather the necessary knowledge to complete the goal of writing a test. Writing tests is part of developing quality software. I hope you see this an opportunity to learn something new that will bring you further in your journey as a software developer. |
This is a counterpart for issue wagtail/wagtail#10678 which changes the foreign key relation of
ABTest
toPageRevision
frommodels.CASCADE
tomodels.PROTECT
The text was updated successfully, but these errors were encountered: