Merge pull request #186 from eReuse/feature/power_on_hours
adding property power_on_hours
This commit is contained in:
commit
075e87b4b1
|
@ -6,10 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
ml).
|
ml).
|
||||||
|
|
||||||
## master
|
## master
|
||||||
[1.0.9-beta]
|
[1.0.10-beta]
|
||||||
|
|
||||||
## testing
|
## testing
|
||||||
[1.0.10-beta]
|
[1.0.11-beta]
|
||||||
|
|
||||||
|
## [1.0.11-beta]
|
||||||
|
|
||||||
## [1.0.10-beta]
|
## [1.0.10-beta]
|
||||||
- [addend] #170 can delete/deactivate devices.
|
- [addend] #170 can delete/deactivate devices.
|
||||||
|
@ -17,6 +19,7 @@ ml).
|
||||||
- [added] #167 new actions of status devices: use, recycling, refurbish and management.
|
- [added] #167 new actions of status devices: use, recycling, refurbish and management.
|
||||||
- [changes] #177 new structure of trade.
|
- [changes] #177 new structure of trade.
|
||||||
- [bugfix] #184 clean nested of schemas of lot
|
- [bugfix] #184 clean nested of schemas of lot
|
||||||
|
- [added] #182 adding power on hours
|
||||||
|
|
||||||
## [1.0.9-beta]
|
## [1.0.9-beta]
|
||||||
- [added] #159 external document as proof of erase of disk
|
- [added] #159 external document as proof of erase of disk
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "1.0.10-beta"
|
__version__ = "1.0.11-beta"
|
||||||
|
|
|
@ -824,6 +824,12 @@ class TestDataStorage(TestMixin, Test):
|
||||||
def reported_uncorrectable_errors(self):
|
def reported_uncorrectable_errors(self):
|
||||||
return self._reported_uncorrectable_errors
|
return self._reported_uncorrectable_errors
|
||||||
|
|
||||||
|
@property
|
||||||
|
def power_on_hours(self):
|
||||||
|
if not self.lifetime:
|
||||||
|
return 0
|
||||||
|
return int(self.lifetime.total_seconds()/3600)
|
||||||
|
|
||||||
@reported_uncorrectable_errors.setter
|
@reported_uncorrectable_errors.setter
|
||||||
def reported_uncorrectable_errors(self, value):
|
def reported_uncorrectable_errors(self, value):
|
||||||
# We assume that a huge number is not meaningful
|
# We assume that a huge number is not meaningful
|
||||||
|
|
|
@ -238,6 +238,7 @@ class TestDataStorage(Test):
|
||||||
length = EnumField(TestDataStorageLength, required=True)
|
length = EnumField(TestDataStorageLength, required=True)
|
||||||
status = SanitizedStr(lower=True, validate=Length(max=STR_SIZE), required=True)
|
status = SanitizedStr(lower=True, validate=Length(max=STR_SIZE), required=True)
|
||||||
lifetime = TimeDelta(precision=TimeDelta.HOURS)
|
lifetime = TimeDelta(precision=TimeDelta.HOURS)
|
||||||
|
power_on_hours = Integer(data_key='powerOnHours', dump_only=True)
|
||||||
assessment = Boolean()
|
assessment = Boolean()
|
||||||
reallocated_sector_count = Integer(data_key='reallocatedSectorCount')
|
reallocated_sector_count = Integer(data_key='reallocatedSectorCount')
|
||||||
power_cycle_count = Integer(data_key='powerCycleCount')
|
power_cycle_count = Integer(data_key='powerCycleCount')
|
||||||
|
|
|
@ -232,9 +232,9 @@ class DeviceRow(OrderedDict):
|
||||||
self['Test {} {} Software'.format(ctype, i)] = ''
|
self['Test {} {} Software'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Type'.format(ctype, i)] = ''
|
self['Test {} {} Type'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Result'.format(ctype, i)] = ''
|
self['Test {} {} Result'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Power on (hours used)'.format(ctype, i)] = ''
|
self['Test {} {} Power cycle count'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Lifetime remaining (percentage)'.format(
|
self['Test {} {} Lifetime (days)'.format(ctype, i)] = ''
|
||||||
ctype, i)] = ''
|
self['Test {} {} Power on hours'.format(ctype, i)] = ''
|
||||||
return
|
return
|
||||||
|
|
||||||
snapshot = get_action(component, 'Snapshot')
|
snapshot = get_action(component, 'Snapshot')
|
||||||
|
@ -329,19 +329,21 @@ class DeviceRow(OrderedDict):
|
||||||
self['Test {} {} Software'.format(ctype, i)] = ''
|
self['Test {} {} Software'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Type'.format(ctype, i)] = ''
|
self['Test {} {} Type'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Result'.format(ctype, i)] = ''
|
self['Test {} {} Result'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Power on (hours used)'.format(ctype, i)] = ''
|
self['Test {} {} Power cycle count'.format(ctype, i)] = ''
|
||||||
self['Test {} {} Lifetime remaining (percentage)'.format(
|
self['Test {} {} Lifetime (days)'.format(ctype, i)] = ''
|
||||||
ctype, i)] = ''
|
self['Test {} {} Power on hours'.format(ctype, i)] = ''
|
||||||
return
|
return
|
||||||
|
|
||||||
self['Test {} {} Software'.format(ctype, i)] = software
|
self['Test {} {} Software'.format(ctype, i)] = software
|
||||||
self['Test {} {} Type'.format(ctype, i)] = test_storage.length.value
|
self['Test {} {} Type'.format(ctype, i)] = test_storage.length.value
|
||||||
self['Test {} {} Result'.format(ctype, i)] = get_result(
|
self['Test {} {} Result'.format(ctype, i)] = get_result(
|
||||||
test_storage)
|
test_storage)
|
||||||
self['Test {} {} Power on (hours used)'.format(ctype, i)] = none2str(
|
self['Test {} {} Power cycle count'.format(ctype, i)] = none2str(
|
||||||
test_storage.power_cycle_count)
|
test_storage.power_cycle_count)
|
||||||
self['Test {} {} Lifetime remaining (percentage)'.format(ctype, i)] = none2str(
|
self['Test {} {} Lifetime (days)'.format(ctype, i)] = none2str(
|
||||||
test_storage.lifetime)
|
test_storage.lifetime)
|
||||||
|
self['Test {} {} Power on hours'.format(ctype, i)] = none2str(
|
||||||
|
test_storage.power_on_hours)
|
||||||
|
|
||||||
def get_graphic_card(self, ctype, i, component):
|
def get_graphic_card(self, ctype, i, component):
|
||||||
"""Particular fields for component GraphicCard."""
|
"""Particular fields for component GraphicCard."""
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -301,10 +301,10 @@ def test_export_extended(app: Devicehub, user: UserClient):
|
||||||
assert fixture_csv[2][22:82] == export_csv[2][22:82], 'Computer information are not equal'
|
assert fixture_csv[2][22:82] == export_csv[2][22:82], 'Computer information are not equal'
|
||||||
assert fixture_csv[2][83] == export_csv[2][83], 'Computer information are not equal'
|
assert fixture_csv[2][83] == export_csv[2][83], 'Computer information are not equal'
|
||||||
assert fixture_csv[2][86:106] == export_csv[2][86:106], 'Computer information are not equal'
|
assert fixture_csv[2][86:106] == export_csv[2][86:106], 'Computer information are not equal'
|
||||||
assert fixture_csv[2][108] == export_csv[2][108], 'Computer information are not equal'
|
assert fixture_csv[2][109] == export_csv[2][109], 'Computer information are not equal'
|
||||||
assert fixture_csv[2][111:131] == export_csv[2][111:131], 'Computer information are not equal'
|
assert fixture_csv[2][112:133] == export_csv[2][112:133], 'Computer information are not equal'
|
||||||
assert fixture_csv[2][131] == export_csv[2][131], 'Computer information are not equal'
|
assert fixture_csv[2][135] == export_csv[2][135], 'Computer information are not equal'
|
||||||
assert fixture_csv[2][136:] == export_csv[2][136:], 'Computer information are not equal'
|
assert fixture_csv[2][138:] == export_csv[2][138:], 'Computer information are not equal'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
|
|
@ -146,6 +146,28 @@ def test_snapshot_update_timefield_updated(user: UserClient):
|
||||||
assert pc1['updated'] != snapshot['device']['updated']
|
assert pc1['updated'] != snapshot['device']['updated']
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_snapshot_power_on_hours(user: UserClient):
|
||||||
|
"""
|
||||||
|
Tests for check if one computer have the time mark updated when one component of it is updated
|
||||||
|
"""
|
||||||
|
snap, _ = user.post(file('asus-eee-1000h.snapshot.bug1857'), res=Snapshot)
|
||||||
|
device = m.Device.query.filter_by(id=snap['device']['id']).one()
|
||||||
|
|
||||||
|
for c in device.components:
|
||||||
|
if c.type == 'HardDrive':
|
||||||
|
hdd = c
|
||||||
|
break
|
||||||
|
|
||||||
|
for ac in hdd.actions:
|
||||||
|
if ac.type == 'TestDataStorage':
|
||||||
|
test_data_storage = ac
|
||||||
|
break
|
||||||
|
|
||||||
|
assert test_data_storage.lifetime.total_seconds()/3600 == test_data_storage.power_on_hours
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
def test_snapshot_component_add_remove(user: UserClient):
|
def test_snapshot_component_add_remove(user: UserClient):
|
||||||
"""Tests adding and removing components and some don't generate HID.
|
"""Tests adding and removing components and some don't generate HID.
|
||||||
|
|
Reference in New Issue