-
Notifications
You must be signed in to change notification settings - Fork 61
Refactor tests #228
base: master
Are you sure you want to change the base?
Refactor tests #228
Conversation
updates both suspicions_command and receipts_text_command tests suites
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.
Instead of passing TestCase
for a custom method I think a better approach would be a Jarba’s TestCase
every test on Jarbas inherit from. For example:
from django.test import TestCase as DjangoTestCase
class TestCase(DjangoTestCase):
def test_serializer(self, obj, expected, input):
serialized = obj.serialize(input)
self.assertEqual(serialized, expected)
This could be at jarbas/core/tests/__init__.py
and imported everywhere as from jarbas.core.tests import TestCase
(instead of importing TestCase
from Django).
Alternatively each app (api
, core
etc.) could have it’s own TestCase
.
What do you think?
I like this a lot! |
- Moved serializer test method to `__init__` - Started using new serializer testing method on suspicions command test suite - Removed serializer test from `shared_tests`
I like it 👍 How do you like it? The only thing — tiny tiny thing that I bet has already crossed your mind — is placing this |
- Created update method on `__init__` - updated suspicions command test suite to use new update method - updated receipts text command test suite to use new update method
- Created handler_with_options method on `__init__` - updated suspicions command test suite to use new handler_with_options method - updated receipts text command test suite to use new handler_with_options method
- Created handler_without_options method on `__init__` - updated suspicions command test suite to use new handler_without_options method - updated receipts text command test suite to use new handler_without_options method
- Created handler_with_non_existing_file method on `__init__` - updated suspicions command test suite to use new handler_with_non_existing_file method - updated receipts text command test suite to use new handler_with_non_existing_file method
- Created new_command method on `__init__` - updated suspicions command test suite to use new_command method - updated receipts text command test suite to use new_command method
- Created add_arguments method on __init__ - updated suspicions command test suite to use new add_arguments method - updated receipts text command test suite to use new add_arguments method
cmd was the same as command in other test suite and is now on a super setUp
@jtemporal Is this a WIP yet? I fixed a typo and merged master to keep the branch updated. Hope you don't mind. IMHO it's good to merge BTW… just clarify the WIP label so I know what to do ; ) |
Don't think so @cuducos the WIP label was removed on aug 7th ;) |
@cuducos Now I think only conflict solving is required cc @anaschwendler |
Just checked the conflicts. IMHO there are pros and cons there: Going with what is in |
As mentioned in #225 in a comment There is a lot of duplicated code that could be shared across test suites.
This is first steps towards removing duplicated code.
A lot needs to be done here and I'm not quite sure this is the best way of doing this. Hoping for some feedback here.