LPTHW EX51 Nosetests giving error but form working

Hi all. I have typed in the code for all the templates and app.py. My browser does not return any error when I put the link in and I am able to type in my name and greeting. However, whenever I try running nosetests, it returns the error below. All my nosetests so far have run okay and I cannot seem to spot any errors in my app_tests module. Could someone suggest what the issue might be?

from nose.tools import *
from app import app

app.config['TESTING'] = True
web = app.test_client()

def test_index():
    rv = web.get('/', follow_redirects=True)
    assert_equal(rv.status_code, 404)

    rv = web.get('/hello', follow_redirects=True)
    assert_equal(rv.status_code, 200)
    assert_in(b"FIll Out This Form", rv.data)

    data = {'name': 'Zed', 'greet': 'Hola'}
    rv = web.post('/hello', follow_redirects=True, data=data)
    assert_in(b"Zed", rv.data)
    assert_in(b"Hola", rv.data)

Screenshot (240)

Hi @heed, I see you running the app.py, but I don’t see the error from running nosetests. Can you show me that?

Also, you can copy paste the PowerShell output and paste it here, then do this:

[code]
powershell here
[/code]

Then I can select from it and show you how to change it.

Hi Zed, typed all the modules over again in a new directory and it runs fine. Can’t still find the error in the original but it works fine now. Thanks!

1 Like