fix tests quotes files

This commit is contained in:
Cayo Puigdefabregas 2022-08-01 20:40:42 +02:00
parent bc339a1cd9
commit bee420c1e7
2 changed files with 6 additions and 6 deletions

View File

@ -399,6 +399,7 @@ def test_export_computer_monitor(user: UserClient):
accept='text/csv', accept='text/csv',
query=[('filter', {'type': ['ComputerMonitor']})], query=[('filter', {'type': ['ComputerMonitor']})],
) )
f = StringIO(csv_str) f = StringIO(csv_str)
obj_csv = csv.reader(f, f) obj_csv = csv.reader(f, f)
export_csv = list(obj_csv) export_csv = list(obj_csv)

View File

@ -1557,12 +1557,11 @@ def test_export_devices_lots(user3: UserClientFlask):
with Path(__file__).parent.joinpath('files').joinpath( with Path(__file__).parent.joinpath('files').joinpath(
'devices_lots.csv' 'devices_lots.csv'
).open() as csv_file: ).open() as csv_file:
obj_csv = csv.reader(csv_file, delimiter=';', quotechar='"') fixture_csv = [line.split(";") for line in csv_file.read().split("\n")]
fixture_csv = list(obj_csv)
assert fixture_csv[0] == export_csv[0], 'Headers are not equal' assert fixture_csv[0] == export_csv[0], 'Headers are not equal'
assert fixture_csv[1][2:] == export_csv[1][2:], 'Computer information are not equal' assert fixture_csv[1][2:] == export_csv[1][2:], 'Computer information are not equal'
UUID(export_csv[1][1]) UUID(export_csv[1][1].replace('"', ''))
@pytest.mark.mvp @pytest.mark.mvp
@ -1593,12 +1592,12 @@ def test_export_lots(user3: UserClientFlask):
with Path(__file__).parent.joinpath('files').joinpath( with Path(__file__).parent.joinpath('files').joinpath(
'lots.csv' 'lots.csv'
).open() as csv_file: ).open() as csv_file:
obj_csv = csv.reader(csv_file, delimiter=';', quotechar='"') fixture_csv = [line.split(";") for line in csv_file.read().split("\n")]
fixture_csv = list(obj_csv)
assert fixture_csv[0] == export_csv[0], 'Headers are not equal' assert fixture_csv[0] == export_csv[0], 'Headers are not equal'
assert fixture_csv[1][1:] == export_csv[1][1:], 'Computer information are not equal' assert fixture_csv[1][1:] == export_csv[1][1:], 'Computer information are not equal'
UUID(export_csv[1][0]) UUID(export_csv[1][0].replace('"', ''))
@pytest.mark.mvp @pytest.mark.mvp