From 071e1452645fe8b7e28c213b6ceb083daea9fedc Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 15 Mar 2022 11:17:05 +0100 Subject: [PATCH] Add body in the check of request --- tests/test_render_2_0.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/test_render_2_0.py diff --git a/tests/test_render_2_0.py b/tests/test_render_2_0.py new file mode 100644 index 00000000..45c79d30 --- /dev/null +++ b/tests/test_render_2_0.py @@ -0,0 +1,28 @@ +# import pytest +from flask.testing import FlaskClient + +from ereuse_devicehub.client import UserClient +from ereuse_devicehub.devicehub import Devicehub + +# from tests import conftest + + +# @pytest.mark.mvp +# @pytest.mark.usefixtures() +# def test_create_application(client: FlaskClient, mocker): +# @pytest.mark.usefixtures(conftest.app_context.__name__) +def test_login(user: UserClient, app: Devicehub): + """Checks a simple login""" + + client = FlaskClient(app, use_cookies=True, response_wrapper=app.response_class) + body, status, headers = client.get('/login/') + body = next(body).decode("utf-8") + assert status == '200 OK' + assert "Login to Your Account" in body + + data = {'email': user.email, 'password': 'foo', "remember": False} + body, status, headers = client.post('/login/', data=data) + + body = next(body).decode("utf-8") + assert status == '200 OK' + assert "Login to Your Account" not in body