user instead of client

This commit is contained in:
Cayo Puigdefabregas 2020-08-05 18:19:27 +02:00
parent cdf36583a9
commit 27ab4cf2ef

View file

@ -13,19 +13,19 @@ from tests.conftest import file
@pytest.mark.mvp
def test_erasure_certificate_public_one(user: UserClient, client: Client):
def test_erasure_certificate_public_one(user: UserClient):
"""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 = client.get(res=documents.DocumentDef.t,
doc, response = user.get(res=documents.DocumentDef.t,
item='erasures/{}'.format(snapshot['device']['id']),
accept=ANY)
assert 'html' in response.content_type
assert '<html' in doc
assert '2018' in doc
doc, response = client.get(res=documents.DocumentDef.t,
doc, response = user.get(res=documents.DocumentDef.t,
item='erasures/{}'.format(snapshot['device']['id']),
query=[('format', 'PDF')],
accept='application/pdf')
@ -33,7 +33,7 @@ def test_erasure_certificate_public_one(user: UserClient, client: Client):
erasure = next(e for e in snapshot['actions'] if e['type'] == 'EraseSectors')
doc, response = client.get(res=documents.DocumentDef.t,
doc, response = user.get(res=documents.DocumentDef.t,
item='erasures/{}'.format(erasure['id']),
accept=ANY)
assert 'html' in response.content_type
@ -68,8 +68,8 @@ def test_erasure_certificate_private_query(user: UserClient):
@pytest.mark.mvp
def test_erasure_certificate_wrong_id(client: Client):
client.get(res=documents.DocumentDef.t, item='erasures/this-is-not-an-id',
def test_erasure_certificate_wrong_id(user: UserClient):
user.get(res=documents.DocumentDef.t, item='erasures/this-is-not-an-id',
status=teal.marshmallow.ValidationError)
@ -222,4 +222,4 @@ def test_export_multiple_different_devices(user: UserClient):
for row in export_csv:
del row[8]
assert fixture_csv == export_csv
assert fixture_csv[:3] == export_csv