6.1 Ensuring Test Isolation in Functional Tests
parent
05b8f21943
commit
5b4547af9a
|
@ -1,9 +1,11 @@
|
||||||
|
from django.test import LiveServerTestCase
|
||||||
|
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium.webdriver.common.keys import Keys
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
class NewVisitorTest(unittest.TestCase):
|
class NewVisitorTest(LiveServerTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.browser = webdriver.Firefox()
|
self.browser = webdriver.Firefox()
|
||||||
|
@ -19,7 +21,7 @@ class NewVisitorTest(unittest.TestCase):
|
||||||
def test_can_start_a_list_and_retrieve_it_later(self):
|
def test_can_start_a_list_and_retrieve_it_later(self):
|
||||||
# Edith has heard about a cool new online to-do app. She goes
|
# Edith has heard about a cool new online to-do app. She goes
|
||||||
# to check out its homepage
|
# to check out its homepage
|
||||||
self.browser.get('http://localhost:8000')
|
self.browser.get(self.live_server_url)
|
||||||
|
|
||||||
# She notices the page title and header mention to-do lists
|
# She notices the page title and header mention to-do lists
|
||||||
self.assertIn('To-Do', self.browser.title)
|
self.assertIn('To-Do', self.browser.title)
|
||||||
|
@ -61,7 +63,3 @@ class NewVisitorTest(unittest.TestCase):
|
||||||
# She visits that URL - her to-do list is still there.
|
# She visits that URL - her to-do list is still there.
|
||||||
|
|
||||||
# Satisfied, she goes back to sleep
|
# Satisfied, she goes back to sleep
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main(warnings='ignore')
|
|
||||||
|
|
Loading…
Reference in New Issue