user instead of client

This commit is contained in:
Cayo Puigdefabregas 2020-08-05 18:19:27 +02:00
parent cdf36583a9
commit 27ab4cf2ef
1 changed files with 7 additions and 7 deletions

View File

@ -13,19 +13,19 @@ from tests.conftest import file
@pytest.mark.mvp @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.""" """Public user can get certificate from one device as HTML or PDF."""
s = file('erase-sectors.snapshot') s = file('erase-sectors.snapshot')
snapshot, _ = user.post(s, res=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']), item='erasures/{}'.format(snapshot['device']['id']),
accept=ANY) accept=ANY)
assert 'html' in response.content_type assert 'html' in response.content_type
assert '<html' in doc assert '<html' in doc
assert '2018' 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']), item='erasures/{}'.format(snapshot['device']['id']),
query=[('format', 'PDF')], query=[('format', 'PDF')],
accept='application/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') 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']), item='erasures/{}'.format(erasure['id']),
accept=ANY) accept=ANY)
assert 'html' in response.content_type assert 'html' in response.content_type
@ -68,8 +68,8 @@ def test_erasure_certificate_private_query(user: UserClient):
@pytest.mark.mvp @pytest.mark.mvp
def test_erasure_certificate_wrong_id(client: Client): def test_erasure_certificate_wrong_id(user: UserClient):
client.get(res=documents.DocumentDef.t, item='erasures/this-is-not-an-id', user.get(res=documents.DocumentDef.t, item='erasures/this-is-not-an-id',
status=teal.marshmallow.ValidationError) status=teal.marshmallow.ValidationError)
@ -222,4 +222,4 @@ def test_export_multiple_different_devices(user: UserClient):
for row in export_csv: for row in export_csv:
del row[8] del row[8]
assert fixture_csv == export_csv assert fixture_csv[:3] == export_csv