-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add phone number while creating or editing address #5731
- Loading branch information
Gaurav Goyal
committed
Sep 25, 2014
1 parent
7c2dd42
commit 80924ff
Showing
2 changed files
with
223 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ def setUp(self): | |
'emails/sale-confirmation-text.jinja': ' ', | ||
'emails/sale-confirmation-html.jinja': ' ', | ||
'checkout.jinja': '{{form.errors|safe}}', | ||
'address-edit.jinja': '{{ form.errors|safe }} ', | ||
'address-add.jinja': ' ', | ||
}) | ||
|
||
# Patch SMTP Lib | ||
|
@@ -716,6 +718,91 @@ def test_0060_regd_user_wrong_address(self): | |
) | ||
self.assertEqual(len(sales), 1) | ||
|
||
def test_0070_regd_user_add_and_edit_address(self): | ||
""" | ||
Registered user will add address from account page | ||
and edit from the shipping address page. | ||
""" | ||
with Transaction().start(DB_NAME, USER, CONTEXT): | ||
self.setup_defaults() | ||
app = self.get_app() | ||
|
||
NereidUser = POOL.get('nereid.user') | ||
Address = POOL.get('party.address') | ||
|
||
country = self.Country(self.available_countries[0]) | ||
subdivision = country.subdivisions[0] | ||
|
||
user, = NereidUser.search([ | ||
('email', '=', '[email protected]') | ||
]) | ||
|
||
with app.test_client() as c: | ||
|
||
# Sign-in | ||
c.post( | ||
'/login', data={ | ||
'email': '[email protected]', | ||
'password': 'password', | ||
} | ||
) | ||
c.post( | ||
'/create-address', data={ | ||
'name': 'Sharoon Thomas', | ||
'street': 'Biscayne Boulevard', | ||
'streetbis': 'Apt. 1906, Biscayne Park', | ||
'zip': 'FL33137', | ||
'city': 'Miami', | ||
'country': country.id, | ||
'subdivision': subdivision.id, | ||
} | ||
) | ||
address, = Address.search([ | ||
('party', '=', user.party.id), | ||
('name', '=', 'Sharoon Thomas'), | ||
]) | ||
|
||
self.assertTrue(address) | ||
|
||
c.post( | ||
'/cart/add', data={ | ||
'product': self.product1.id, 'quantity': 5 | ||
} | ||
) | ||
|
||
rv = c.post('/edit-address/22') | ||
|
||
self.assertEqual(rv.status_code, 403) | ||
|
||
rv = c.get( | ||
'/edit-address/%d' % ( | ||
address.id, | ||
) + '?next=%2Fcheckout%2Fshipping-address' | ||
) | ||
self.assertEqual(rv.status_code, 200) | ||
|
||
rv = c.post( | ||
'/edit-address/%d' % ( | ||
address.id, | ||
) + '?next=%2Fcheckout%2Fshipping-address', data={ | ||
'name': 'Sharoon Thomas', | ||
'street': 'Biscayne Boulevard', | ||
'streetbis': 'Apt. 1906, Biscayne Park', | ||
'zip': 'FL33137', | ||
'city': 'Miami', | ||
'country': country.id, | ||
'subdivision': subdivision.id, | ||
'phone': '12345678' | ||
} | ||
) | ||
self.assertTrue( | ||
rv.location.endswith('/checkout/shipping-address') | ||
) | ||
|
||
self.assertEqual(address.phone_number.value, '12345678') | ||
|
||
self.assertEqual(rv.status_code, 302) | ||
|
||
|
||
class TestCheckoutDeliveryMethod(BaseTestCheckout): | ||
"Test the Delivery Method Step" | ||
|