Background Image
Table of Contents Table of Contents
Previous Page  112 / 478 Next Page
Information
Show Menu
Previous Page 112 / 478 Next Page
Page Background

Figure 6-1. The TDD process with functional and unit tests

Let’s translate our scratchpad into our functional test. As soon as Edith submits a first

list item, we’ll want to create a new list, adding one item to it, and take her to the URL

for her list. Look for the point at which we say

inputbox.send_keys('Buy peacock

feathers')

, and amend the next block of code like this:

functional_tests/tests.py.

inputbox

.

send_keys

(

'Buy peacock feathers'

)

# When she hits enter, she is taken to a new URL,

# and now the page lists "1: Buy peacock feathers" as an item in a

# to-do list table

inputbox

.

send_keys

(

Keys

.

ENTER

)

edith_list_url

=

self

.

browser

.

current_url

self

.

assertRegex

(

edith_list_url

,

'/lists/.+'

)

#

self

.

check_for_row_in_list_table

(

'1: Buy peacock feathers'

)

# There is still a text box inviting her to add another item. She

[

...

]

84

|

Chapter 6: Getting to the Minimum Viable Site