fix export placeholders

This commit is contained in:
Cayo Puigdefabregas 2022-07-20 11:19:45 +02:00
parent d51a3d3b56
commit 02404c4277
5 changed files with 9 additions and 12 deletions

View File

@ -65,7 +65,7 @@ class DeviceRow(OrderedDict):
self['Device Hardware ID'] = device.hid
self['Device Type'] = device.t
self['Device Chassis'] = ''
if isinstance(device, d.Computer):
if isinstance(device, d.Computer) and not device.placeholder:
self['Device Chassis'] = device.chassis.name
self['Device Serial Number'] = none2str(device.serial_number)
self['Device Model'] = none2str(device.model)
@ -119,8 +119,6 @@ class DeviceRow(OrderedDict):
self['Data Storage Rate'] = ''
self['Data Storage Range'] = ''
self['Price'] = none2str(device.price)
benchram = get_action(device, 'BenchmarkRamSysbench')
if benchram:
self['Benchmark RamSysbench (points)'] = none2str(benchram.rate)
@ -384,7 +382,6 @@ class StockRow(OrderedDict):
self['Lifecycle state'] = device.last_action_of(*states.Trading.actions()).t
except LookupError:
self['Lifecycle state'] = ''
self['Price'] = none2str(device.price)
self['Processor'] = none2str(device.processor_model)
self['RAM (MB)'] = none2str(device.ram_size)
self['Data Storage Size (MB)'] = none2str(device.data_storage_size)

View File

@ -1,2 +1,2 @@
Type;Chassis;Serial Number;Model;Manufacturer;Registered in;Physical state;Allocate state;Lifecycle state;Price;Processor;RAM (MB);Data Storage Size (MB)
Desktop;Microtower;d1s;d1ml;d1mr;Mon May 16 19:08:44 2022;;;;;p1ml;0;0
Type;Chassis;Serial Number;Model;Manufacturer;Registered in;Physical state;Allocate state;Lifecycle state;Processor;RAM (MB);Data Storage Size (MB)
Desktop;Microtower;d1s;d1ml;d1mr;Wed Jul 20 11:11:28 2022;;;;p1ml;0;0

1 Type Chassis Serial Number Model Manufacturer Registered in Physical state Allocate state Lifecycle state Price Processor RAM (MB) Data Storage Size (MB)
2 Desktop Microtower d1s d1ml d1mr Mon May 16 19:08:44 2022 Wed Jul 20 11:11:28 2022 p1ml 0 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -479,6 +479,7 @@ def test_export_multiple_different_devices(user: UserClient):
query=[('filter', {'type': ['Computer', 'Keyboard', 'Monitor']})],
accept='text/csv',
)
f = StringIO(csv_str)
obj_csv = csv.reader(f, f)
export_csv = list(obj_csv)
@ -491,7 +492,6 @@ def test_export_multiple_different_devices(user: UserClient):
@pytest.mark.mvp
def test_report_devices_stock_control(user: UserClient, user2: UserClient):
# TODO
"""Test export device information in a csv file."""
snapshot, _ = user.post(file('basic.snapshot'), res=Snapshot)
snapshot2, _ = user2.post(file('basic.snapshot2'), res=Snapshot)