First Functional Test specced out in comments, Added unittest
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| db.sqlite3 | ||||
| .venv  | ||||
| "__pycache__"  | ||||
| "*.pyc"  | ||||
| __pycache__ | ||||
| *.pyc | ||||
|   | ||||
| @@ -1,7 +1,35 @@ | ||||
| import unittest | ||||
| from selenium import webdriver | ||||
|  | ||||
| browser = webdriver.Firefox() | ||||
| browser.get("http://localhost:8000") | ||||
| class NewVisitorTest(unittest.TestCase): | ||||
|   def setUp(self): | ||||
|     self.browser = webdriver.Firefox() | ||||
|    | ||||
| assert "Congratulations!" in browser.title | ||||
| print("OK") | ||||
|   def tearDown(self): | ||||
|     self.browser.quit() | ||||
|    | ||||
|   def test_can_start_a_todo_list(self): | ||||
|     # Ig has heard about a cool new online to-do app. | ||||
|     # He goes to check out its homepage | ||||
|     self.browser.get("http://localhost:8000") | ||||
|     # He notices the page title and header mention to-do lists | ||||
|     self.assertIn("To-Do", self.browser.title) | ||||
|  | ||||
|     # He is invited to enter a to-do item straight away | ||||
|     self.fail("Finish the test!") | ||||
|  | ||||
|     # He types "Buy peacock feathers" into a text box | ||||
|     # (Ig's hobby is tying fly-fishing lures) | ||||
|  | ||||
|     # When he hits enter, the page updates, and now the page lists | ||||
|     # "1: Buy peacock feathers" as an item in a to-do list | ||||
|  | ||||
|     # There is still a text box inviting him to add another item. | ||||
|     # He enters "Use peacock feathers to make a fly" (Ig is very methodical) | ||||
|  | ||||
|     # The page updates again, and now shows both items on his list | ||||
|  | ||||
|     # Satisfied, he goes back to sleep | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|   unittest.main() | ||||
		Reference in New Issue
	
	Block a user