Skip to content

Commit 1ad63ae

Browse files
committed
We now have a form for entering message
1 parent d2a2ffe commit 1ad63ae

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

PROCESS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,9 @@ Run Functional Test(Failing)
136136
Let's code some html, currently it's looking for header.
137137

138138

139-
Now we are coding for the next page with url "/send_sms/"
139+
Now we are coding for the next page with url "/send_sms/"
140+
141+
Now we are done with coding the send_sms page with form.
142+
143+
Let's go to the view function for send_sms, it's time for unit test.
144+

functional_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ def test_can_view_the_page(self):
5757
# Lastly a button to submit the form.
5858
send_sms_button = self.browser.find_element_by_id('id_send_sms')
5959
self.assertEqual(
60-
send_sms_button.get_attribute('value'),
60+
send_sms_button.text,
6161
"Send SMS"
6262
)
6363

64-
6564
# So he add his contact number on the first field. 09152087801
6665
input_contact.send_keys("09152087801")
6766

@@ -77,6 +76,8 @@ def test_can_view_the_page(self):
7776
# With a notification that says, "Message sent, please wait for reply!"
7877
message_notification = self.browser.find_element_by_css_selector('.messages li:first-child').text()
7978

79+
self.assertEqual(self.browser.current_url, "http://localhost:8000/")
80+
8081
# He still didn't see any reply.
8182
table_replies = self.browser.find_element_by_id("id_table_replies")
8283
rows = table_replies.find_element_by_tag_name("tr")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Send SMS</title>
5+
</head>
6+
<body>
7+
<header>Fill this information to send an SMS</header>
8+
9+
<form method="POST">
10+
{% csrf_token %}
11+
<input type="text" id="id_contact" name="contact" placeholder="Enter phone number" />
12+
<textarea id="id_message" name="message" placeholder="Enter your message"></textarea>
13+
<button type="submit" id="id_send_sms">Send SMS</button>
14+
</form>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)