testsFri, 30 Jun 2023

import unittest class TestAdd(unittest.TestCase): def test_add(self): self.assertIn('<form id="form-login" class="form" method="POST" action="/login">', test_add(1, 2), 3)

###### Exercise: Write a test for the login page Write a test that takes an email and password, submits the form, and checks that the user is redirected to the "/profile" page. ## Authoring a TestCase * For each test method, the instance will be set up by calling: * setUpClass * setUp * If setUpClass raises an exception, the test class is not loaded. * If setUp raises an exception, the test method is not executed. * The tearDown method is still called. * The tearDown method is called after each test method. * The tearDownClass method is called after all tests have been executed. * If setUpClass or setUp raises an exception, tearDownClass or tearDown will not be called. ## Using the command line `python -m unittest` will run all the tests. `python -m unittest test_app.py` will run all the tests in test_app.py. `python -m unittest test_app.py:Test

Questions about programming?Chat with your personal AI assistant