O'Reilly logo

Test-Driven Development with Django by Kevin Harvey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding content via the Django admin

Our next task is our first chance to add data to the admin site:

# He adds a track to an album that already exists self.browser.find_element_by_link_text('Add track').click() track_form = self.browser.find_element_by_id('track_form') track_form.find_element_by_name('name').send_keys('So What') track_form.find_element_by_name('album').\ find_elements_by_tag_name('option')[1].click() track_form.find_element_by_name('track_number').\ send_keys('1') track_form.find_element_by_name('slug').send_keys('so-what') track_form.find_element_by_css_selector( '.submit-row input').click() self.assertEqual( self.browser.find_elements_by_css_selector( '#result_list tr')[1].text, 'Kind of Blue So What 1' ) self.fail('Incomplete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required