From 67cfac6adcea023bef07b295604d4e6ecab924eb Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 28 Oct 2022 10:08:11 +0200 Subject: [PATCH] fix tests --- tests/conftest.py | 2 ++ tests/test_render_2_0.py | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8e5c52d1..8a10cea8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,6 +22,7 @@ from ereuse_devicehub.devicehub import Devicehub from ereuse_devicehub.inventory.views import devices from ereuse_devicehub.labels.views import labels from ereuse_devicehub.mail.flask_mail import Mail +from ereuse_devicehub.register.views import register from ereuse_devicehub.resources.agent.models import Person from ereuse_devicehub.resources.enums import SessionType from ereuse_devicehub.resources.tag import Tag @@ -65,6 +66,7 @@ def _app(config: TestConfig) -> Devicehub: app.register_blueprint(labels) app.register_blueprint(api) app.register_blueprint(workbench) + app.register_blueprint(register) app.config["SQLALCHEMY_RECORD_QUERIES"] = True app.config['PROFILE'] = True # app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30]) diff --git a/tests/test_render_2_0.py b/tests/test_render_2_0.py index 4e85ec9f..f95adf40 100644 --- a/tests/test_render_2_0.py +++ b/tests/test_render_2_0.py @@ -2586,14 +2586,15 @@ def test_snapshot_is_server_erase(user3: UserClientFlask): @pytest.mark.usefixtures(conftest.app_context.__name__) def test_new_register(user3: UserClientFlask, app: Devicehub): uri = '/new_register/' - user3.get(uri) + body, status = user3.get(uri) + assert "Create your account" in body + data = { 'csrf_token': generate_csrf(), 'email': "foo@bar.cxm", - 'password': "1234", - 'password2': "1234", + 'password': "123456", + 'password2': "123456", 'name': "booBar", - 'telephone': "555555555", } body, status = user3.post(uri, data=data) assert status == '200 OK' @@ -2605,7 +2606,7 @@ def test_new_register(user3: UserClientFlask, app: Devicehub): uri = '/validate_user/' + str(user_valid.token) body, status = user3.get(uri) assert status == '200 OK' - assert "Your new user is activate" in body + assert "You have successfully activated your account!" in body assert user_valid.user.active