fix export placeholders
This commit is contained in:
parent
d51a3d3b56
commit
02404c4277
|
@ -65,7 +65,7 @@ class DeviceRow(OrderedDict):
|
||||||
self['Device Hardware ID'] = device.hid
|
self['Device Hardware ID'] = device.hid
|
||||||
self['Device Type'] = device.t
|
self['Device Type'] = device.t
|
||||||
self['Device Chassis'] = ''
|
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 Chassis'] = device.chassis.name
|
||||||
self['Device Serial Number'] = none2str(device.serial_number)
|
self['Device Serial Number'] = none2str(device.serial_number)
|
||||||
self['Device Model'] = none2str(device.model)
|
self['Device Model'] = none2str(device.model)
|
||||||
|
@ -119,8 +119,6 @@ class DeviceRow(OrderedDict):
|
||||||
self['Data Storage Rate'] = ''
|
self['Data Storage Rate'] = ''
|
||||||
self['Data Storage Range'] = ''
|
self['Data Storage Range'] = ''
|
||||||
|
|
||||||
self['Price'] = none2str(device.price)
|
|
||||||
|
|
||||||
benchram = get_action(device, 'BenchmarkRamSysbench')
|
benchram = get_action(device, 'BenchmarkRamSysbench')
|
||||||
if benchram:
|
if benchram:
|
||||||
self['Benchmark RamSysbench (points)'] = none2str(benchram.rate)
|
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
|
self['Lifecycle state'] = device.last_action_of(*states.Trading.actions()).t
|
||||||
except LookupError:
|
except LookupError:
|
||||||
self['Lifecycle state'] = ''
|
self['Lifecycle state'] = ''
|
||||||
self['Price'] = none2str(device.price)
|
|
||||||
self['Processor'] = none2str(device.processor_model)
|
self['Processor'] = none2str(device.processor_model)
|
||||||
self['RAM (MB)'] = none2str(device.ram_size)
|
self['RAM (MB)'] = none2str(device.ram_size)
|
||||||
self['Data Storage Size (MB)'] = none2str(device.data_storage_size)
|
self['Data Storage Size (MB)'] = none2str(device.data_storage_size)
|
||||||
|
|
|
@ -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)
|
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;Mon May 16 19:08:44 2022;;;;;p1ml;0;0
|
Desktop;Microtower;d1s;d1ml;d1mr;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
|
@ -479,6 +479,7 @@ def test_export_multiple_different_devices(user: UserClient):
|
||||||
query=[('filter', {'type': ['Computer', 'Keyboard', 'Monitor']})],
|
query=[('filter', {'type': ['Computer', 'Keyboard', 'Monitor']})],
|
||||||
accept='text/csv',
|
accept='text/csv',
|
||||||
)
|
)
|
||||||
|
|
||||||
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)
|
||||||
|
@ -491,7 +492,6 @@ def test_export_multiple_different_devices(user: UserClient):
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
def test_report_devices_stock_control(user: UserClient, user2: UserClient):
|
def test_report_devices_stock_control(user: UserClient, user2: UserClient):
|
||||||
# TODO
|
|
||||||
"""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)
|
snapshot2, _ = user2.post(file('basic.snapshot2'), res=Snapshot)
|
||||||
|
|
Reference in New Issue