Тестирую функцию логина с помощью pytest (
https://flask.palletsprojects.com/en/1.1.x/testing/#logging-in-and-out)
Вот полный код теста:
class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite://'
@pytest.fixture
def client():
app = create_app(TestConfig)
context_processor = app.context_processor(inject_template_scope)
with app.test_client() as client:
with app.app_context():
db.create_all()
yield client
def login(client, username, password):
return
client.post('/auth/login', data=dict(
username=username,
password=password
), follow_redirects=True)
def test_login(client):
rv = login(client, 'test', 'test')
assert 'Редактировать' in rv.get_data(as_text=True)
на выходе получаю:
<много html текста> + 400 Bad Request + <много html текста>
подскажите, где ошибка?