add check of permissions

This commit is contained in:
Cayo Puigdefabregas 2020-08-05 12:24:36 +02:00
parent 19bff82873
commit 597ff3dc11
1 changed files with 6 additions and 1 deletions

View File

@ -226,9 +226,11 @@ def test_export_multiple_different_devices(user: UserClient):
@pytest.mark.mvp @pytest.mark.mvp
def test_report_devices_stock_control(user: UserClient): def test_report_devices_stock_control(user: UserClient, user2: UserClient):
"""Test export device information in a csv file.""" """Test export device information in a csv file."""
snapshot, _ = user.post(file('basic.snapshot'), res=Snapshot) snapshot, _ = user.post(file('basic.snapshot'), res=Snapshot)
snapshot2, _ = user2.post(file('basic.snapshot2'), res=Snapshot)
csv_str, _ = user.get(res=documents.DocumentDef.t, csv_str, _ = user.get(res=documents.DocumentDef.t,
item='stock/', item='stock/',
accept='text/csv', accept='text/csv',
@ -242,6 +244,9 @@ def test_report_devices_stock_control(user: UserClient):
obj_csv = csv.reader(csv_file) obj_csv = csv.reader(csv_file)
fixture_csv = list(obj_csv) fixture_csv = list(obj_csv)
assert user.user['id'] != user2.user['id']
assert len(export_csv) == 2
assert isinstance(datetime.strptime(export_csv[1][5], '%c'), datetime), \ assert isinstance(datetime.strptime(export_csv[1][5], '%c'), datetime), \
'Register in field is not a datetime' 'Register in field is not a datetime'