Commit 6 Wordbucket : Ensuring Test Isolation
Commits on Feb 26, 2018
เปลี่ยน unittest.TestCase เป็น LiveServerTestCase จึงสามารถใช้ self.live_server_url แทนกำหนดเป็น localhost:8000 ได้ทำให้ง่ายต่อการทดสอบเมื่อ deploy webapp. แล้ว
| | @@ -1,9 +1,9 @@ |
| | +from django.test import LiveServerTestCase |
| | from selenium import webdriver |
| | from selenium.webdriver.common.keys import Keys |
| | import time |
| | -import unittest |
| | |
| | -class NewVisitorTest(unittest.TestCase): |
| | +class NewVisitorTest(LiveServerTestCase): |
| | |
| | def setUp(self): |
| | self.browser = webdriver.Firefox() |
| @@ -19,7 +19,7 @@ def check_for_row_in_list_table(self, row_text): |
| | def test_can_start_a_list_and_retrieve_it_later(self): |
| | # Ann has heard about a cool new online word app. She goes |
| | # 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 Word Bucket lists |
| | self.assertIn('Word Bucket', self.browser.title) |
ไม่มีความคิดเห็น:
แสดงความคิดเห็น