-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add tests with success messages for locale creation, editing, and deletion #763
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #763 +/- ##
==========================================
+ Coverage 92.64% 92.73% +0.09%
==========================================
Files 47 47
Lines 4065 4130 +65
Branches 602 603 +1
==========================================
+ Hits 3766 3830 +64
Misses 176 176
- Partials 123 124 +1 ☔ View full report in Codecov by Sentry. |
Hi @zerolab |
@ACK1D thank you very much for this. I am not sure how to make Codecov update its comment, but https://app.codecov.io/gh/wagtail/wagtail-localize/pull/762 shows a +0.11% increase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ACK1D kudos for expanding the test locales test coverage.
I left a few notes around the consistency of self.client.get/post vs self.get/post which would be nice to tidy up and be consistent about.
self.assertEqual( | ||
response.context["form"].fields["language_code"].choices, [("fr", "French")] | ||
) | ||
|
||
def test_create(self): | ||
response = self.post( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestLocaleCreateView
still has a post
method that posts to reverse("wagtaillocales:add")
. I'd say keep using it, especially that we're using that in at least one other place
@@ -190,10 +277,14 @@ def post(self, post_data=None, locale=None): | |||
) | |||
|
|||
def test_simple(self): | |||
response = self.get() | |||
# Test rendering the edit view with simple data | |||
response = self.client.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we now seem to have a mix of self.client.get
like here, and self.get
below (like in test_invalid_language
). It would be nice to be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done is better than perfect. Thanks @ACK1D for the tweaks
Added tests for #762 (success messages for create, edit, and delete locale). Some logic has been refactored into BaseLocaleTestCase, and correcting some tests for use it. Please review code and let me know if need some work.