Hi want to test the "delete route" in my flask application in terminal I can see that the test is past and it said "test_user_delete (test_app.LayoutTestCase) ... ok" But when I open the cover page it still with red color which means doesn't cover it wold you please someone explain to me why and where I am doing wrong?
app.layout.view.py
test.py
e1 = Users(name='admine2', email='admine2@gmail.com', age=25)
e2 = Users(name='teste2', email='teste2@gmail.com', age=27)
db.session.add_all([e1, e2])
db.session.commit()
u = Users.query.get(1)
db.session.remove()
db.session.delete(u)
response = self.client.post('/delete/1',
follow_redirects=True)
self.assertTrue('admine2 is removed!', response.data)
view.py:
@layout.route('/delete/<int:id>')
def delete(id):
"""remove monkey"""
user = Users.query.get_or_404(id)
db.session.delete(user)
db.session.commit()
flash("{0} is removed!".format(user.name))
return redirect(url_for("layout.user", page=1, sortby='normal'))
Not Found
\nThe requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
\n' – LiLi Feb 23 '15 at 12:02