-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
16 additions
and
83 deletions.
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 |
---|---|---|
|
@@ -44,14 +44,11 @@ <h1 class="description-title">{% trans "Tell us a bit about yourself" %}</h1> | |
</div> | ||
</div> | ||
<div class="name-email"> | ||
<label for="name" class="name">{% trans "Full Name" %} *<br> | ||
<input type="text" placeholder="John DOE" id="name" class="client-name" | ||
maxlength="100" minlength="3" required name="name"> | ||
<label for="{{ form.name.id_for_label }}" class="name">{% trans "Full Name" %} *<br> | ||
{{ client_data_form.name }} | ||
</label> | ||
<label for="email" class="email">{% trans "Email" %} *<br> | ||
<input type="email" placeholder="[email protected]" id="email" | ||
class="client-email" name="email" | ||
maxlength="100" required> | ||
<label for="{{ form.email.id_for_label }}" class="email">{% trans "Email" %} *<br> | ||
{{ client_data_form.email }} | ||
</label> | ||
</div> | ||
<div class="receive-email"> | ||
|
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 |
---|---|---|
|
@@ -29,10 +29,7 @@ | |
from appointment.tests.base.base_test import BaseTest | ||
from appointment.utils.db_helpers import Service, WorkingHours, create_user_with_username | ||
from appointment.utils.error_codes import ErrorCode | ||
from appointment.views import ( | ||
create_appointment, get_client_data_from_post, | ||
redirect_to_payment_or_thank_you_page, verify_user_and_login | ||
) | ||
from appointment.views import create_appointment, redirect_to_payment_or_thank_you_page, verify_user_and_login | ||
|
||
|
||
class SlotTestCase(BaseTest): | ||
|
@@ -1048,63 +1045,6 @@ def test_notify_admin_about_reschedule_called(self, mock_notify_admin): | |
self.assertTrue(mock_notify_admin.called) | ||
|
||
|
||
class GetClientDataFromPostTests(BaseTest): | ||
def setUp(self): | ||
self.factory = RequestFactory() | ||
|
||
def test_get_client_data_with_full_data(self): | ||
"""Test retrieving client data from a POST request with all fields provided.""" | ||
post_data = { | ||
'name': 'John Doe', | ||
'email': '[email protected]', | ||
} | ||
request = self.factory.post('/fake-url/', post_data) | ||
|
||
client_data = get_client_data_from_post(request) | ||
|
||
self.assertEqual(client_data['name'], post_data['name']) | ||
self.assertEqual(client_data['email'], post_data['email']) | ||
|
||
def test_get_client_data_with_missing_name(self): | ||
"""Test retrieving client data from a POST request with the name missing.""" | ||
post_data = { | ||
# 'name' is missing | ||
'email': '[email protected]', | ||
} | ||
request = self.factory.post('/fake-url/', post_data) | ||
|
||
client_data = get_client_data_from_post(request) | ||
|
||
self.assertIsNone(client_data['name'], "name should be None if not provided") | ||
self.assertEqual(client_data['email'], post_data['email']) | ||
|
||
def test_get_client_data_with_missing_email(self): | ||
"""Test retrieving client data from a POST request with the email missing.""" | ||
post_data = { | ||
'name': 'John Doe', | ||
# 'email' is missing | ||
} | ||
request = self.factory.post('/fake-url/', post_data) | ||
|
||
client_data = get_client_data_from_post(request) | ||
|
||
self.assertEqual(client_data['name'], post_data['name']) | ||
self.assertIsNone(client_data['email'], "email should be None if not provided") | ||
|
||
def test_get_client_data_with_empty_fields(self): | ||
"""Test retrieving client data from a POST request with empty fields.""" | ||
post_data = { | ||
'name': '', | ||
'email': '', | ||
} | ||
request = self.factory.post('/fake-url/', post_data) | ||
|
||
client_data = get_client_data_from_post(request) | ||
|
||
self.assertEqual(client_data['name'], '', "name should be empty string if provided as such") | ||
self.assertEqual(client_data['email'], '', "email should be empty string if provided as such") | ||
|
||
|
||
class RedirectToPaymentOrThankYouPageTests(BaseTest): | ||
def setUp(self): | ||
super().setUp() | ||
|
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