-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Update checkout tests with new factories #1645
Conversation
- Update CheckoutMixin - Add functional tests to IndexView, ShippingAddressView, UserAddressUpdateView and DeleteUserAddressView
Wow, lovely work. I'm having a look at the phone number issue now. |
There is no trace of action `delete` in any Oscar template.
I lost wifi on the train and then got changed to a train without power outlets... I'll get to look at it on Friday. |
I'll add few more tests in the next days. Is there a reason to keep both |
We have two methods doing something very similiar, so I'm removing the one with the worse name. Thanks go to @itbabu for spotting it in #1645 (comment)
Marco, you're right, those two helpers are duplicates. I removed one here: 09f66c3 I also had a look at the unused delete code in Thanks for this. I'll investigate the phone number thing after lunch. |
@itbabu, why are you suggesting adding unique IDs to the |
Previously, we just used force_text() to serialise it. This somehow made Django 1.6 print out the full representation (see #1645). It is the wrong approach anyway, as we allow changing the standard display to a regional format. But in the session we should always include the country code. Luckily the easy fix is to just store things as an international phone number.
* Uses factory-boy factories * Adds helpers to the CheckoutMixin helper * Adds plenty of functional tests * Adds HTML IDs to some forms to be able to easily reference them from our tests This commit is the squashed version of #1645 by @maikhoepfel, but it does not contain the template changes. The unused ShippingAddressView code was already cherry-picked across in 549decb.
@maikhoepfel It simplifes and make more understandable a functional test when we need to select a form inside a page. There are already some tests in Oscar using this. django-oscar/tests/functional/customer/profile_tests.py Lines 32 to 41 in 485a5d0
|
* Uses factory-boy factories * Adds helpers to the CheckoutMixin helper * Adds plenty of functional tests * Adds HTML IDs to some forms to be able to easily reference them from our tests @maikhoepfel: This commit is the squashed version of #1645, but it does not contain the template changes. The unused ShippingAddressView code was already cherry-picked across in 549decb. I also fixed some PEP8 issues.
PR #1645 pointed to an issue with phone numbers. After digging into the code for a while, I opted to redo the phone number field implementation according to the Django documentation. It always takes me a bit of time to grok descriptors; the new implementation avoids them.
PR #1645 pointed to an issue with phone numbers. After digging into the code for a while, I opted to redo the phone number field implementation according to the Django documentation. It always takes me a bit of time to grok descriptors; the new implementation avoids them.
PR #1645 pointed to an issue with phone numbers. After digging into the code for a while, I opted to redo the phone number field implementation according to the Django documentation. It always takes me a bit of time to grok descriptors; the new implementation avoids them. Note that this does not fix any issue; it's just a simplication done while searching for the bug.
Django calls force_text on PhoneNumber instances when populating a model form. Django 1.6's force_text implementation unfortunately checks for __unicode__, which is defined in the base class. As we're using the python_2_unicode_compatible decorator, in Python 2 __unicode__ is already overwritten by the decorator. In Python 3, we can safely return __str__ because it returns unicode. This was discovered by @itbabu in #1645.
Django calls force_text on PhoneNumber instances when populating a model form. Django 1.6's force_text implementation unfortunately checks for __unicode__, which is defined in the base class. As we're using the python_2_unicode_compatible decorator, in Python 2 __unicode__ is already overwritten by the decorator. In Python 3, we can safely return __str__ because it returns unicode. This was discovered by @itbabu in #1645.
@itbabu, thanks for all the work and taking the time to explain. I just pushed a squashed version of your work in a0ce8f2. Apart from some PEP8 changes and using I did quite a bit of cleanup along the way: 7b31081 and ee43070. With that, I'm closing this PR. You're most welcome to add more tests; please create a new PR for that. |
Adds new functional tests for ShippingAddressView, PaymentDetailsView and ThankYouView. It's the second part of django-oscar#1645 (be9d0d3) Notes * Adds a custom template to be able to test some functionalities of PaymentDetailsView * Adds an helper to the CheckoutMixin
Adds new functional tests for ShippingAddressView, PaymentDetailsView and ThankYouView. It's the second part of django-oscar#1645. Notes * Adds a custom template to be able to test some functionalities of PaymentDetailsView * Adds an helper to the CheckoutMixin
Adds new functional tests for ShippingAddressView, PaymentDetailsView and ThankYouView. It's the second part of #1645. Notes * Adds a custom template to be able to test some functionalities of PaymentDetailsView * Adds an helper to the CheckoutMixin
I added fuctional tests to some checkout views: IndexView, ShippingAddressView, UserAddressUpdateView and DeleteUserAddressView.
There are some views left but in the meantime a test highlights that phonenumber is not working as expected with Python 3 and Django 1.6
This test will fail:
It seems that the form is filled with the stringified phone number object and so the submit fails.
I still have to figure out why this happens