new endpoint live
This commit is contained in:
parent
4ffd95c158
commit
676cfe96d8
|
@ -1321,7 +1321,6 @@ class Live(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
|||
@property
|
||||
def usage_time_allocate(self):
|
||||
"""Show how many hours is used one device from the last check"""
|
||||
# import pdb; pdb.set_trace()
|
||||
self.sort_actions()
|
||||
if self.usage_time_hdd is None:
|
||||
return self.last_usage_time_allocate()
|
||||
|
|
|
@ -432,10 +432,6 @@ class Live(ActionWithOneDevice):
|
|||
description='The software that generated this Snapshot.')
|
||||
version = Version(required=True, description='The version of the software.')
|
||||
final_user_code = SanitizedStr(data_key="finalUserCode", dump_only=True)
|
||||
software = EnumField(SnapshotSoftware,
|
||||
required=True,
|
||||
description='The software that generated this Snapshot.')
|
||||
version = Version(required=True, description='The version of the software.')
|
||||
licence_version = Version(required=True, description='The version of the software.')
|
||||
components = NestedOn(s_device.Component,
|
||||
many=True,
|
||||
|
@ -443,7 +439,8 @@ class Live(ActionWithOneDevice):
|
|||
'at the moment of this Snapshot.'
|
||||
'Order is preserved, so the component num 0 when'
|
||||
'submitting is the component num 0 when returning it back.')
|
||||
usage_time_allocate = TimeDelta(data_key='usageTimeAllocate', required=False,)
|
||||
usage_time_allocate = TimeDelta(data_key='usageTimeAllocate', required=False,
|
||||
precision=TimeDelta.HOURS, dump_only=True)
|
||||
|
||||
|
||||
class Organize(ActionWithMultipleDevices):
|
||||
|
|
|
@ -121,7 +121,6 @@ class LiveView(View):
|
|||
"""We get the liftime and serial_number of the disk"""
|
||||
usage_time_hdd = None
|
||||
serial_number = None
|
||||
import pdb; pdb.set_trace()
|
||||
for hd in snapshot['components']:
|
||||
if not isinstance(hd, DataStorage):
|
||||
continue
|
||||
|
@ -175,7 +174,6 @@ class LiveView(View):
|
|||
if not device.allocated:
|
||||
raise ValidationError('Sorry this device is not allocated.')
|
||||
|
||||
import pdb; pdb.set_trace()
|
||||
usage_time_hdd, serial_number = self.get_hdd_details(snapshot, device)
|
||||
|
||||
data_live = {'usage_time_hdd': usage_time_hdd,
|
||||
|
|
|
@ -454,12 +454,10 @@ def test_live_search_last_allocate(user: UserClient, app: Devicehub):
|
|||
hdd_action['lifetime'] += 1000
|
||||
acer.pop('elapsed')
|
||||
acer['licence_version'] = '1.0.0'
|
||||
import pdb; pdb.set_trace()
|
||||
live, _ = user.post(acer, res=models.Live)
|
||||
acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec4"
|
||||
actions = [a for a in acer['components'][7]['actions'] if a['type'] != 'TestDataStorage']
|
||||
acer['components'][7]['actions'] = actions
|
||||
import pdb; pdb.set_trace()
|
||||
live, _ = user.post(acer, res=models.Live)
|
||||
assert live['usageTimeAllocate'] == 1000
|
||||
|
||||
|
|
Reference in a new issue