fix tests

This commit is contained in:
Cayo Puigdefabregas 2022-10-28 10:08:11 +02:00
parent 4bbec903ef
commit 67cfac6adc
2 changed files with 8 additions and 5 deletions

View File

@ -22,6 +22,7 @@ from ereuse_devicehub.devicehub import Devicehub
from ereuse_devicehub.inventory.views import devices from ereuse_devicehub.inventory.views import devices
from ereuse_devicehub.labels.views import labels from ereuse_devicehub.labels.views import labels
from ereuse_devicehub.mail.flask_mail import Mail 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.agent.models import Person
from ereuse_devicehub.resources.enums import SessionType from ereuse_devicehub.resources.enums import SessionType
from ereuse_devicehub.resources.tag import Tag from ereuse_devicehub.resources.tag import Tag
@ -65,6 +66,7 @@ def _app(config: TestConfig) -> Devicehub:
app.register_blueprint(labels) app.register_blueprint(labels)
app.register_blueprint(api) app.register_blueprint(api)
app.register_blueprint(workbench) app.register_blueprint(workbench)
app.register_blueprint(register)
app.config["SQLALCHEMY_RECORD_QUERIES"] = True app.config["SQLALCHEMY_RECORD_QUERIES"] = True
app.config['PROFILE'] = True app.config['PROFILE'] = True
# app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30]) # app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])

View File

@ -2586,14 +2586,15 @@ def test_snapshot_is_server_erase(user3: UserClientFlask):
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_new_register(user3: UserClientFlask, app: Devicehub): def test_new_register(user3: UserClientFlask, app: Devicehub):
uri = '/new_register/' uri = '/new_register/'
user3.get(uri) body, status = user3.get(uri)
assert "Create your account" in body
data = { data = {
'csrf_token': generate_csrf(), 'csrf_token': generate_csrf(),
'email': "foo@bar.cxm", 'email': "foo@bar.cxm",
'password': "1234", 'password': "123456",
'password2': "1234", 'password2': "123456",
'name': "booBar", 'name': "booBar",
'telephone': "555555555",
} }
body, status = user3.post(uri, data=data) body, status = user3.post(uri, data=data)
assert status == '200 OK' assert status == '200 OK'
@ -2605,7 +2606,7 @@ def test_new_register(user3: UserClientFlask, app: Devicehub):
uri = '/validate_user/' + str(user_valid.token) uri = '/validate_user/' + str(user_valid.token)
body, status = user3.get(uri) body, status = user3.get(uri)
assert status == '200 OK' 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 assert user_valid.user.active