def test_index(): # create a version of our website that we can use for testing with app.test_client() as test_client: # mimic a browser: 'GET /', as if you visit the site response = test_client.get('/') # check that the HTTP response is a success assert response.status_code == 200 # Store the contents of the html response in a local variable. # This should be a string with the same content as the file index.html html_content = response.data.decode() assert "<html>" in html_content
def test_colors(): with app.test_client() as test_client: response = test_client.post('/color') assert response.status_code == 200
def test_colors(): with app.test_client() as test_client: response = test_client.post('/color', data=dict(color='blue')) assert response.status_code == 200
def test_colors(): with app.test_client() as test_client: response = test_client.post('/color', data={'color': '#d2b48c'}) assert response.status_code == 200