check the token in a test

This commit is contained in:
Cayo Puigdefabregas 2021-04-13 18:34:18 +02:00
parent 21f019dc14
commit ca85a1f221
1 changed files with 22 additions and 15 deletions

View File

@ -12,12 +12,14 @@ from ereuse_utils.test import ANY
from ereuse_devicehub.client import Client, UserClient from ereuse_devicehub.client import Client, UserClient
from ereuse_devicehub.devicehub import Devicehub from ereuse_devicehub.devicehub import Devicehub
from ereuse_devicehub.resources.user.models import Session
from ereuse_devicehub.resources.action.models import Snapshot, Allocate, Live from ereuse_devicehub.resources.action.models import Snapshot, Allocate, Live
from ereuse_devicehub.resources.documents import documents from ereuse_devicehub.resources.documents import documents
from ereuse_devicehub.resources.device import models as d from ereuse_devicehub.resources.device import models as d
from ereuse_devicehub.resources.lot.models import Lot from ereuse_devicehub.resources.lot.models import Lot
from ereuse_devicehub.resources.tag.model import Tag from ereuse_devicehub.resources.tag.model import Tag
from ereuse_devicehub.resources.hash_reports import ReportHash from ereuse_devicehub.resources.hash_reports import ReportHash
from ereuse_devicehub.resources.enums import SessionType
from ereuse_devicehub.db import db from ereuse_devicehub.db import db
from tests import conftest from tests import conftest
from tests.conftest import file from tests.conftest import file
@ -646,6 +648,7 @@ def test_get_document_internal_stats(user: UserClient, user2: UserClient):
assert csv_str.strip() == '""' assert csv_str.strip() == '""'
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_get_wbconf(user: UserClient): def test_get_wbconf(user: UserClient):
"""Tests for get env file for usb wb.""" """Tests for get env file for usb wb."""
@ -655,3 +658,7 @@ def test_get_wbconf(user: UserClient):
env, _ = user.get(res=documents.DocumentDef.t, item='wbconf/usodywipe', accept=ANY) env, _ = user.get(res=documents.DocumentDef.t, item='wbconf/usodywipe', accept=ANY)
assert 'WB_ERASE = False' in env assert 'WB_ERASE = False' in env
# assert 'WB_ERASE = True' in env # assert 'WB_ERASE = True' in env
session = Session.query.filter_by(user_id=user.user['id'],
type=SessionType.Internal).first()
assert str(session.token) in env