import csv from datetime import datetime from io import StringIO from pathlib import Path import pytest import teal.marshmallow from ereuse_utils.test import ANY from ereuse_devicehub.client import Client, UserClient from ereuse_devicehub.devicehub import Devicehub from ereuse_devicehub.resources.action.models import Snapshot from ereuse_devicehub.resources.documents import documents from ereuse_devicehub.resources.device import models as d from ereuse_devicehub.resources.lot.models import Lot from ereuse_devicehub.resources.tag.model import Tag from ereuse_devicehub.db import db from tests.conftest import file @pytest.mark.mvp def test_erasure_certificate_public_one(user: UserClient, client: Client): """Public user can get certificate from one device as HTML or PDF.""" s = file('erase-sectors.snapshot') snapshot, _ = user.post(s, res=Snapshot) doc, response = user.get(res=documents.DocumentDef.t, item='erasures/{}'.format(snapshot['device']['id']), accept=ANY) assert 'html' in response.content_type assert '