'Flask' object has no attribute 'post' error for login unit test
<p>I am trying to test my log in functionality with Flask-Testing.  I'm following the <a href="http://flask.pocoo.org/docs/0.10/testing/" rel="nofollow">Flask docs on testing</a> as well. The <code>test_login()</code> function raises <code>AttributeError: 'Flask' object has no attribute 'post'</code>.  Why am I getting this error?</p>

<pre><code>Traceback (most recent call last):
  File "/home/lucas/PycharmProjects/FYP/Shares/tutorial/steps/test.py", line 57, in test_login_logout
rv = self.login('lucas', 'test') &lt;br&gt; &lt;br&gt;
  File "/home/lucas/PycharmProjects/FYP/Shares/tutorial/steps/test.py", line 47, in login
return self.app.post('/login', data=dict(
AttributeError: 'Flask' object has no attribute 'post'
</code></pre>



<pre><code>from flask.ext.testing import TestCase
from flask import Flask
from Shares import db
import manage

class test(TestCase):

def create_app(self):

    app = Flask(__name__)
    app.config['TESTING'] = True
    return app

SQLALCHEMY_DATABASE_URI = "sqlite://"
TESTING = True

def setUp(self):
    manage.initdb()

def tearDown(self):
    db.session.remove()
    db.drop_all()

def test_adduser(self):
    user = User(username="test", email="test@test.com")
    user2 = User(username="lucas", email="lucas@test.com")

    db.session.add(user)
    db.session.commit()

    assert user in db.session
    assert user2 not in db.session

def login(self, username, password):
    return self.app.post('/login', data=dict(
        username=username,
        password=password
    ), follow_redirects=True)

def logout(self):
    return self.app.get('/logout', follow_redirects=True)

def test_login(self):
    rv = self.login('lucas', 'test')
    assert 'You were logged in' in rv.data
</code></pre>