first iteration integration with blockchain
This commit is contained in:
parent
dc8aea9b9b
commit
d1cff3e44e
|
@ -1448,6 +1448,32 @@ class Receive(JoinedTableMixin, ActionWithMultipleDevices):
|
|||
default=ReceiverRole.Intermediary)
|
||||
|
||||
|
||||
class ShareDeliveryNote(JoinedTableMixin, ActionWithMultipleDevices):
|
||||
"""To share a DeliveryNote to between owners."""
|
||||
# New variables for DeliveryNote
|
||||
supplier = db.Column() # String, nullable, ...
|
||||
supplier.comment = """Name of the organization/agent that create DeliveryNote."""
|
||||
date_delivery_note = db.Column()
|
||||
date_delivery_note.comment = """Date of note creation."""
|
||||
# Is the same of lot id??
|
||||
id_delivery_note = db.Column(UUID(as_uuid=True))
|
||||
id_delivery_note.comment = """Unique id of lot and delivery note."""
|
||||
deposit = db.Column()
|
||||
deposit.comment = """Total amount of deposit devices in Lot."""
|
||||
address_note = db.Column(UUID(as_uuid=True))
|
||||
address_note.comment = """Address identifier in the blockchain."""
|
||||
|
||||
agent_id = Column(UUID(as_uuid=True),
|
||||
ForeignKey(Agent.id),
|
||||
nullable=False,
|
||||
default=lambda: g.user.individual.id)
|
||||
|
||||
|
||||
class ConfirmDeliveryNote(JoinedTableMixin, ActionWithMultipleDevices):
|
||||
"""To confirm a DeliveryNote that has been shared."""
|
||||
pass
|
||||
|
||||
|
||||
class Migrate(JoinedTableMixin, ActionWithMultipleDevices):
|
||||
"""Moves the devices to a new database/inventory. Devices cannot be
|
||||
modified anymore at the previous database.
|
||||
|
|
|
@ -533,6 +533,10 @@ class Receive(ActionWithMultipleDevices):
|
|||
self.role = ... # type: ReceiverRole
|
||||
|
||||
|
||||
class ShareDeliveryNote(ActionWithMultipleDevices):
|
||||
pass
|
||||
|
||||
|
||||
class Migrate(ActionWithMultipleDevices):
|
||||
other = ... # type: Column
|
||||
|
||||
|
|
|
@ -438,6 +438,15 @@ class Receive(ActionWithMultipleDevices):
|
|||
role = EnumField(ReceiverRole)
|
||||
|
||||
|
||||
class ShareDeliveryNote(ActionWithMultipleDevices):
|
||||
__doc__ = m.ShareDeliveryNote.__doc__
|
||||
supplier = SanitizedStr(validate=Length(max=STR_SIZE), data_key='supplierName')
|
||||
date_delivery_note = DateTime(data_key='dateDeliveryNote')
|
||||
deposit = Integer(data_key='depositValue')
|
||||
address_note = UUID(dump_only=True)
|
||||
id_delivery_note = UUID(dump_only=True)
|
||||
|
||||
|
||||
class Migrate(ActionWithMultipleDevices):
|
||||
__doc__ = m.Migrate.__doc__
|
||||
other = URL()
|
||||
|
|
|
@ -95,8 +95,7 @@ class Device(Thing):
|
|||
color.comment = """The predominant color of the device."""
|
||||
production_date = Column(db.DateTime)
|
||||
production_date.comment = """The date of production of the device.
|
||||
This is timezone naive, as Workbench cannot report this data
|
||||
with timezone information.
|
||||
This is timezone naive, as Workbench cannot report this data with timezone information.
|
||||
"""
|
||||
variant = Column(db.CIText())
|
||||
variant.comment = """A variant or sub-model of the device."""
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="{{ url_for('Document.static', filename='print.css') }}">
|
||||
<title>Devicehub | {{ title }}</title>
|
||||
<title>USOdy | {{ title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
|
|
@ -110,6 +110,3 @@ BEGIN
|
|||
END
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,18 @@ class Lot(Thing):
|
|||
description.comment = """A comment about the lot."""
|
||||
closed = db.Column(db.Boolean, default=False, nullable=False)
|
||||
closed.comment = """A closed lot cannot be modified anymore."""
|
||||
|
||||
# New variables for DeliveryNote
|
||||
supplier = db.Column() # String, nullable, ...
|
||||
supplier.comment = """Name of the organization/agent that create DeliveryNote."""
|
||||
date_delivery_note = db.Column()
|
||||
date_delivery_note.comment = """Date of note creation."""
|
||||
# Is the same of lot id??
|
||||
id_delivery_note = db.Column(UUID(as_uuid=True))
|
||||
id_delivery_note.comment = """Unique id of lot and delivery note"""
|
||||
# deposit = db.Column()
|
||||
# deposit.comment = """Total amount of deposit devices in Lot."""
|
||||
|
||||
devices = db.relationship(Device,
|
||||
backref=db.backref('lots', lazy=True, collection_class=set),
|
||||
secondary=lambda: LotDevice.__table__,
|
||||
|
|
|
@ -88,6 +88,18 @@ class Path:
|
|||
self.path = ... # type: Ltree
|
||||
self.created = ... # type: datetime
|
||||
|
||||
@classmethod
|
||||
def has_lot(cls, id, id1):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def delete(cls, id, id1):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def add(cls, id, id1):
|
||||
pass
|
||||
|
||||
|
||||
class LotDeviceDescendants(db.Model):
|
||||
device_id = ... # type: Column
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
---
|
||||
components:
|
||||
- size: 10.030411318500475
|
||||
technology: LCD
|
||||
resolutionWidth: 1024
|
||||
model: AUO LCD Monitor
|
||||
actions: []
|
||||
type: Display
|
||||
refreshRate: 60
|
||||
productionDate: '2009-01-04T00:00:00'
|
||||
manufacturer: AUO "AUO"
|
||||
serialNumber:
|
||||
resolutionHeight: 600
|
||||
- generation:
|
||||
actions:
|
||||
- rate: 164.4981
|
||||
type: BenchmarkProcessorSysbench
|
||||
elapsed: 165
|
||||
- rate: 6650.48
|
||||
type: BenchmarkProcessor
|
||||
elapsed: 0
|
||||
speed: 1
|
||||
cores: 1
|
||||
model: Intel Atom CPU N450 @ 1.66GHz
|
||||
address: 64
|
||||
type: Processor
|
||||
threads: 2
|
||||
manufacturer: Intel Corp.
|
||||
serialNumber:
|
||||
brand: Atom
|
||||
- memory:
|
||||
model: Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller
|
||||
actions: []
|
||||
type: GraphicCard
|
||||
manufacturer: Intel Corporation
|
||||
serialNumber:
|
||||
- size: 2200
|
||||
technology: LiIon
|
||||
actions:
|
||||
- size: 641
|
||||
type: MeasureBattery
|
||||
voltage: 12608
|
||||
cycleCount:
|
||||
severity: Info
|
||||
model: AL10A31
|
||||
type: Battery
|
||||
manufacturer: SANYO
|
||||
serialNumber:
|
||||
- type: SoundCard
|
||||
actions: []
|
||||
manufacturer: Intel Corporation
|
||||
serialNumber:
|
||||
model: NM10/ICH7 Family High Definition Audio Controller
|
||||
- type: SoundCard
|
||||
actions: []
|
||||
manufacturer: XPA970VW0
|
||||
serialNumber:
|
||||
model: 1.3M WebCam
|
||||
- size: 1024
|
||||
actions: []
|
||||
format: SODIMM
|
||||
model: 48594D503131325336344350362D53362020
|
||||
interface: DDR2
|
||||
type: RamModule
|
||||
manufacturer: Hynix Semiconductor
|
||||
serialNumber: 4F43487B
|
||||
speed: 667
|
||||
- size: 160041.88569599998
|
||||
variant: 1A01
|
||||
actions:
|
||||
- type: EraseBasic
|
||||
steps:
|
||||
- type: StepRandom
|
||||
endTime: '2019-10-23T08:35:31.400587+00:00'
|
||||
severity: Info
|
||||
startTime: '2019-10-23T07:49:54.410830+00:00'
|
||||
endTime: '2019-10-23T08:35:31.400988+00:00'
|
||||
severity: Info
|
||||
startTime: '2019-10-23T07:49:54.410193+00:00'
|
||||
- elapsed: 22
|
||||
writeSpeed: 17.3
|
||||
readSpeed: 41.6
|
||||
type: BenchmarkDataStorage
|
||||
- status: Completed without error
|
||||
reallocatedSectorCount: 0
|
||||
currentPendingSectorCount: 0
|
||||
assessment: true
|
||||
severity: Info
|
||||
offlineUncorrectable: 0
|
||||
lifetime: 4692
|
||||
type: TestDataStorage
|
||||
length: Short
|
||||
elapsed: 118
|
||||
powerCycleCount: 5293
|
||||
model: WDC WD1600BEVT-2
|
||||
interface: ATA
|
||||
type: HardDrive
|
||||
manufacturer: Western Digital
|
||||
serialNumber: WD-WX11A80W7430
|
||||
- variant: c1
|
||||
actions: []
|
||||
speed: 100
|
||||
model: AR8152 v1.1 Fast Ethernet
|
||||
wireless: false
|
||||
type: NetworkAdapter
|
||||
serialNumber: 88:ae:1d:a6:f3:d0
|
||||
manufacturer: Qualcomm Atheros
|
||||
- variant: '00'
|
||||
actions: []
|
||||
speed:
|
||||
model: Centrino Wireless-N 1000 Condor Peak
|
||||
wireless: true
|
||||
type: NetworkAdapter
|
||||
serialNumber: 00:26:c7:8e:cb:8c
|
||||
manufacturer: Intel Corporation
|
||||
- ramMaxSize: 4
|
||||
slots: 1
|
||||
model: AOHAPPY
|
||||
pcmcia: 0
|
||||
type: Motherboard
|
||||
version: V3.05(DDR2)
|
||||
ramSlots: 2
|
||||
serialNumber: Base Board Serial Number
|
||||
manufacturer: Acer
|
||||
serial: 1
|
||||
actions: []
|
||||
biosDate: '2010-08-12T00:00:00'
|
||||
firewire: 0
|
||||
usb: 5
|
||||
software: Workbench
|
||||
device:
|
||||
sku:
|
||||
chassis: Netbook
|
||||
actions:
|
||||
- type: StressTest
|
||||
elapsed: 60
|
||||
severity: Info
|
||||
- rate: 19.2726
|
||||
type: BenchmarkRamSysbench
|
||||
elapsed: 19
|
||||
model: AOHAPPY
|
||||
type: Laptop
|
||||
version: V3.05
|
||||
manufacturer: Acer
|
||||
serialNumber: LUSEA0D010038879A01601
|
||||
uuid: 490fb8c0-81a1-42e9-95e0-5e7db7038ec2
|
||||
type: Snapshot
|
||||
version: 11.0b9
|
||||
endTime: '2019-10-23T07:43:13.625104+00:00'
|
||||
elapsed: 3138
|
||||
closed: true
|
|
@ -139,6 +139,7 @@ def test_multiple_rates(user: UserClient):
|
|||
This ensures that rates only takes all the correct actions
|
||||
and components rates in case device have new tests/benchmarks.
|
||||
"""
|
||||
|
||||
pc = Desktop(chassis=ComputerChassis.Tower)
|
||||
hdd = HardDrive(size=476940)
|
||||
hdd.actions_one.add(BenchmarkDataStorage(read_speed=126, write_speed=29.8))
|
||||
|
|
|
@ -12,7 +12,8 @@ from ereuse_devicehub.client import UserClient
|
|||
from ereuse_devicehub.db import db
|
||||
from ereuse_devicehub.devicehub import Devicehub
|
||||
from ereuse_devicehub.resources.action.models import Action, BenchmarkDataStorage, \
|
||||
BenchmarkProcessor, EraseSectors, RateComputer, Snapshot, SnapshotRequest, VisualTest
|
||||
BenchmarkProcessor, EraseSectors, RateComputer, Snapshot, SnapshotRequest, VisualTest, \
|
||||
MeasureBattery, BenchmarkRamSysbench, StressTest
|
||||
from ereuse_devicehub.resources.device import models as m
|
||||
from ereuse_devicehub.resources.device.exceptions import NeedsId
|
||||
from ereuse_devicehub.resources.device.models import SolidStateDrive
|
||||
|
@ -492,3 +493,11 @@ def test_pc_rating_rate_none(user: UserClient):
|
|||
def test_pc_2(user: UserClient):
|
||||
s = file('laptop-hp_255_g3_notebook-hewlett-packard-cnd52270fw.snapshot')
|
||||
snapshot, _ = user.post(res=Snapshot, data=s)
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason='Add battery component assets')
|
||||
def test_snapshot_pc_with_battery_component(user: UserClient):
|
||||
pc1 = file('acer.happy.battery.snapshot')
|
||||
snapshot = snapshot_and_check(user, pc1,
|
||||
action_types=(StressTest.t, BenchmarkRamSysbench.t),
|
||||
perform_second_snapshot=False)
|
||||
|
|
Reference in New Issue