Sort events by default using end_time
This commit is contained in:
parent
58be2162f7
commit
0dc8ced255
|
@ -121,5 +121,5 @@
|
||||||
],
|
],
|
||||||
"version": "11.0a4",
|
"version": "11.0a4",
|
||||||
"elapsed": 6,
|
"elapsed": 6,
|
||||||
"endTime": "2016-11-03T17:17:17.266543"
|
"endTime": "2016-11-03T17:17:17.266543+00:00"
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,15 +92,15 @@
|
||||||
{
|
{
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"startTime": "2018-07-11T11:20:01.005336",
|
"startTime": "2018-07-11T11:20:01.005336+00:00",
|
||||||
"endTime": "2018-07-11T11:42:12.971177"
|
"endTime": "2018-07-11T11:42:12.971177+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"endTime": "2018-07-11T11:42:12.975358",
|
"endTime": "2018-07-11T11:42:12.975358+00:00",
|
||||||
"startTime": "2018-07-11T11:20:01.004892"
|
"startTime": "2018-07-11T11:20:01.004892+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"writeSpeed": 26.6,
|
"writeSpeed": 26.6,
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
"version": "11.0a3",
|
"version": "11.0a3",
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"elapsed": 1512,
|
"elapsed": 1512,
|
||||||
"endTime": "2018-07-11T11:17:00.888231",
|
"endTime": "2018-07-11T11:17:00.888231+00:00",
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
"expectedEvents": [
|
"expectedEvents": [
|
||||||
"Benchmark",
|
"Benchmark",
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"elapsed": -3058,
|
"elapsed": -3058,
|
||||||
"uuid": "106930cd-e948-4cca-a8c8-1e39d6192ad6",
|
"uuid": "106930cd-e948-4cca-a8c8-1e39d6192ad6",
|
||||||
"endTime": "2018-07-11T10:47:50.822380",
|
"endTime": "2018-07-11T10:47:50.822380+00:00",
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "Processor",
|
"type": "Processor",
|
||||||
|
@ -73,15 +73,15 @@
|
||||||
{
|
{
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
|
|
||||||
"endTime": "2018-07-11T11:56:52.390306",
|
"endTime": "2018-07-11T11:56:52.390306+00:00",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"startTime": "2018-07-11T10:49:31.998217",
|
"startTime": "2018-07-11T10:49:31.998217+00:00",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"endTime": "2018-07-11T11:56:52.386505",
|
"endTime": "2018-07-11T11:56:52.386505+00:00",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"startTime": "2018-07-11T10:49:31.998609"
|
"startTime": "2018-07-11T10:49:31.998609+00:00"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,17 +80,17 @@
|
||||||
"readSpeed": 77.7
|
"readSpeed": 77.7
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"startTime": "2018-07-11T10:32:14.445306",
|
"startTime": "2018-07-11T10:32:14.445306+00:00",
|
||||||
|
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endTime": "2018-07-11T10:53:46.442123",
|
"endTime": "2018-07-11T10:53:46.442123+00:00",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"startTime": "2018-07-11T10:32:14.445496",
|
"startTime": "2018-07-11T10:32:14.445496+00:00",
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endTime": "2018-07-11T10:53:46.438901"
|
"endTime": "2018-07-11T10:53:46.438901+00:00"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -112,17 +112,17 @@
|
||||||
"length": "Short"
|
"length": "Short"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"startTime": "2018-07-11T10:53:46.442187",
|
"startTime": "2018-07-11T10:53:46.442187+00:00",
|
||||||
|
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endTime": "2018-07-11T11:16:28.469899",
|
"endTime": "2018-07-11T11:16:28.469899+00:00",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"startTime": "2018-07-11T10:53:46.442343",
|
"startTime": "2018-07-11T10:53:46.442343+00:00",
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endTime": "2018-07-11T11:16:28.463789"
|
"endTime": "2018-07-11T11:16:28.463789+00:00"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -175,6 +175,6 @@
|
||||||
"EraseBasic"
|
"EraseBasic"
|
||||||
],
|
],
|
||||||
"software": "Workbench",
|
"software": "Workbench",
|
||||||
"endTime": "2018-07-11T10:30:22.395958",
|
"endTime": "2018-07-11T10:30:22.395958+00:00",
|
||||||
"elapsed": 2766
|
"elapsed": 2766
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"uuid": "9c3560a9-371c-4392-b586-37090b5f79c6",
|
"uuid": "9c3560a9-371c-4392-b586-37090b5f79c6",
|
||||||
"version": "11.0a3",
|
"version": "11.0a3",
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2018-07-11T13:26:29.365504",
|
"endTime": "2018-07-11T13:26:29.365504+00:00",
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
"device": {
|
"device": {
|
||||||
"serialNumber": "PB357N0",
|
"serialNumber": "PB357N0",
|
||||||
|
@ -99,15 +99,15 @@
|
||||||
"status": "Unspecified Error. Self-test not started."
|
"status": "Unspecified Error. Self-test not started."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"startTime": "2018-07-11T13:28:07.319948",
|
"startTime": "2018-07-11T13:28:07.319948+00:00",
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"endTime": "2018-07-11T14:04:04.864425",
|
"endTime": "2018-07-11T14:04:04.864425+00:00",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"startTime": "2018-07-11T13:28:07.320244",
|
"startTime": "2018-07-11T13:28:07.320244+00:00",
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"endTime": "2018-07-11T14:04:04.861590",
|
"endTime": "2018-07-11T14:04:04.861590+00:00",
|
||||||
"severity": "Info"
|
"severity": "Info"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -101,14 +101,14 @@
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endTime": "2018-07-11T11:33:41.531918",
|
"endTime": "2018-07-11T11:33:41.531918+00:00",
|
||||||
"startTime": "2018-07-11T10:30:35.643855",
|
"startTime": "2018-07-11T10:30:35.643855+00:00",
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"endTime": "2018-07-11T11:33:41.529224",
|
"endTime": "2018-07-11T11:33:41.529224+00:00",
|
||||||
"startTime": "2018-07-11T10:30:35.644043",
|
"startTime": "2018-07-11T10:30:35.644043+00:00",
|
||||||
"severity": "Info"
|
"severity": "Info"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
"StressTest",
|
"StressTest",
|
||||||
"EraseBasic"
|
"EraseBasic"
|
||||||
],
|
],
|
||||||
"endTime": "2018-07-11T10:28:55.879745",
|
"endTime": "2018-07-11T10:28:55.879745+00:00",
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
"elapsed": 3886,
|
"elapsed": 3886,
|
||||||
"closed": false
|
"closed": false
|
||||||
|
|
|
@ -98,15 +98,15 @@
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"startTime": "2018-07-03T09:15:22.257059",
|
"startTime": "2018-07-03T09:15:22.257059+00:00",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endTime": "2018-07-03T10:32:11.843190"
|
"endTime": "2018-07-03T10:32:11.843190+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"startTime": "2018-07-03T09:15:22.256074",
|
"startTime": "2018-07-03T09:15:22.256074+00:00",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
|
|
||||||
"endTime": "2018-07-03T10:32:11.848455"
|
"endTime": "2018-07-03T10:32:11.848455+00:00"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
"version": "11.0a2",
|
"version": "11.0a2",
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
"software": "Workbench",
|
"software": "Workbench",
|
||||||
"endTime": "2018-07-03T09:10:57.034598",
|
"endTime": "2018-07-03T09:10:57.034598+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"type": "Laptop",
|
"type": "Laptop",
|
||||||
"model": "1001PXD",
|
"model": "1001PXD",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"uuid": "0c822fb7-6e51-4781-86cf-994bd306212e",
|
"uuid": "0c822fb7-6e51-4781-86cf-994bd306212e",
|
||||||
"software": "Workbench",
|
"software": "Workbench",
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2018-07-05T11:57:17.284891",
|
"endTime": "2018-07-05T11:57:17.284891+00:00",
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "NetworkAdapter",
|
"type": "NetworkAdapter",
|
||||||
|
|
|
@ -167,5 +167,5 @@
|
||||||
"model": "HP Compaq 8100 Elite SFF"
|
"model": "HP Compaq 8100 Elite SFF"
|
||||||
},
|
},
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
"endTime": "2018-06-29T12:28:54.508266"
|
"endTime": "2018-06-29T12:28:54.508266+00:00"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Benchmark",
|
"Benchmark",
|
||||||
"StressTest"
|
"StressTest"
|
||||||
],
|
],
|
||||||
"endTime": "2018-06-29T15:29:29.322424",
|
"endTime": "2018-06-29T15:29:29.322424+00:00",
|
||||||
"elapsed": 391,
|
"elapsed": 391,
|
||||||
"software": "Workbench",
|
"software": "Workbench",
|
||||||
"components": [
|
"components": [
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
"serialNumber": "CZC0408YJG"
|
"serialNumber": "CZC0408YJG"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"endTime": "2018-07-11T16:11:43.467824",
|
"endTime": "2018-07-11T16:11:43.467824+00:00",
|
||||||
"version": "11.0a3",
|
"version": "11.0a3",
|
||||||
"software": "Workbench",
|
"software": "Workbench",
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
|
|
|
@ -44,8 +44,6 @@ class Device(Thing):
|
||||||
Devices can contain ``Components``, which are just a type of device
|
Devices can contain ``Components``, which are just a type of device
|
||||||
(it is a recursive relationship).
|
(it is a recursive relationship).
|
||||||
"""
|
"""
|
||||||
EVENT_SORT_KEY = attrgetter('created')
|
|
||||||
|
|
||||||
id = Column(BigInteger, Sequence('device_seq'), primary_key=True)
|
id = Column(BigInteger, Sequence('device_seq'), primary_key=True)
|
||||||
id.comment = """
|
id.comment = """
|
||||||
The identifier of the device for this database. Used only
|
The identifier of the device for this database. Used only
|
||||||
|
@ -150,7 +148,7 @@ class Device(Thing):
|
||||||
|
|
||||||
Events are returned by descending ``created`` time.
|
Events are returned by descending ``created`` time.
|
||||||
"""
|
"""
|
||||||
return sorted(chain(self.events_multiple, self.events_one), key=self.EVENT_SORT_KEY)
|
return sorted(chain(self.events_multiple, self.events_one))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def problems(self):
|
def problems(self):
|
||||||
|
@ -285,8 +283,7 @@ class Device(Thing):
|
||||||
raise LookupError('{!r} does not contain events of types {}.'.format(self, types))
|
raise LookupError('{!r} does not contain events of types {}.'.format(self, types))
|
||||||
|
|
||||||
def _warning_events(self, events):
|
def _warning_events(self, events):
|
||||||
return sorted((ev for ev in events if ev.severity >= Severity.Warning),
|
return sorted(ev for ev in events if ev.severity >= Severity.Warning)
|
||||||
key=self.EVENT_SORT_KEY)
|
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return self.id < other.id
|
return self.id < other.id
|
||||||
|
@ -393,7 +390,7 @@ class Computer(Device):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def events(self) -> list:
|
def events(self) -> list:
|
||||||
return sorted(chain(super().events, self.events_parent), key=self.EVENT_SORT_KEY)
|
return sorted(chain(super().events, self.events_parent))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ram_size(self) -> int:
|
def ram_size(self) -> int:
|
||||||
|
@ -565,7 +562,7 @@ class Component(Device):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def events(self) -> list:
|
def events(self) -> list:
|
||||||
return sorted(chain(super().events, self.events_components), key=self.EVENT_SORT_KEY)
|
return sorted(chain(super().events, self.events_components))
|
||||||
|
|
||||||
|
|
||||||
class JoinedComponentTableMixin:
|
class JoinedComponentTableMixin:
|
||||||
|
|
|
@ -12,7 +12,7 @@ Within the above general classes are subclasses in A order.
|
||||||
|
|
||||||
from collections import Iterable
|
from collections import Iterable
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta, timezone
|
||||||
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_UP
|
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_UP
|
||||||
from typing import Optional, Set, Union
|
from typing import Optional, Set, Union
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
@ -22,6 +22,7 @@ import teal.db
|
||||||
from boltons import urlutils
|
from boltons import urlutils
|
||||||
from citext import CIText
|
from citext import CIText
|
||||||
from flask import current_app as app, g
|
from flask import current_app as app, g
|
||||||
|
from sortedcontainers import SortedSet
|
||||||
from sqlalchemy import BigInteger, Boolean, CheckConstraint, Column, Enum as DBEnum, \
|
from sqlalchemy import BigInteger, Boolean, CheckConstraint, Column, Enum as DBEnum, \
|
||||||
Float, ForeignKey, Integer, Interval, JSON, Numeric, SmallInteger, Unicode, event, orm
|
Float, ForeignKey, Integer, Interval, JSON, Numeric, SmallInteger, Unicode, event, orm
|
||||||
from sqlalchemy.dialects.postgresql import UUID
|
from sqlalchemy.dialects.postgresql import UUID
|
||||||
|
@ -55,6 +56,13 @@ class JoinedTableMixin:
|
||||||
return Column(UUID(as_uuid=True), ForeignKey(Event.id), primary_key=True)
|
return Column(UUID(as_uuid=True), ForeignKey(Event.id), primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
|
_sorted_events = {
|
||||||
|
'order_by': lambda: Event.end_time,
|
||||||
|
'collection_class': SortedSet
|
||||||
|
}
|
||||||
|
"""For db.backref, return the events sorted by end_time."""
|
||||||
|
|
||||||
|
|
||||||
class Event(Thing):
|
class Event(Thing):
|
||||||
"""Event performed on a device.
|
"""Event performed on a device.
|
||||||
|
|
||||||
|
@ -100,8 +108,7 @@ class Event(Thing):
|
||||||
backref=backref('events',
|
backref=backref('events',
|
||||||
lazy=True,
|
lazy=True,
|
||||||
cascade=CASCADE_OWN,
|
cascade=CASCADE_OWN,
|
||||||
order_by=lambda: Event.created,
|
**_sorted_events),
|
||||||
collection_class=OrderedSet),
|
|
||||||
primaryjoin='Event.snapshot_id == Snapshot.id')
|
primaryjoin='Event.snapshot_id == Snapshot.id')
|
||||||
|
|
||||||
author_id = Column(UUID(as_uuid=True),
|
author_id = Column(UUID(as_uuid=True),
|
||||||
|
@ -126,10 +133,7 @@ class Event(Thing):
|
||||||
default=lambda: g.user.individual.id)
|
default=lambda: g.user.individual.id)
|
||||||
# todo compute the org
|
# todo compute the org
|
||||||
agent = relationship(Agent,
|
agent = relationship(Agent,
|
||||||
backref=backref('events_agent',
|
backref=backref('events_agent', lazy=True, **_sorted_events),
|
||||||
lazy=True,
|
|
||||||
collection_class=OrderedSet,
|
|
||||||
order_by=lambda: Event.created),
|
|
||||||
primaryjoin=agent_id == Agent.id)
|
primaryjoin=agent_id == Agent.id)
|
||||||
agent_id.comment = """
|
agent_id.comment = """
|
||||||
The direct performer or driver of the action. e.g. John wrote a book.
|
The direct performer or driver of the action. e.g. John wrote a book.
|
||||||
|
@ -139,10 +143,7 @@ class Event(Thing):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
components = relationship(Component,
|
components = relationship(Component,
|
||||||
backref=backref('events_components',
|
backref=backref('events_components', lazy=True, **_sorted_events),
|
||||||
lazy=True,
|
|
||||||
order_by=lambda: Event.created,
|
|
||||||
collection_class=OrderedSet),
|
|
||||||
secondary=lambda: EventComponent.__table__,
|
secondary=lambda: EventComponent.__table__,
|
||||||
order_by=lambda: Component.id,
|
order_by=lambda: Component.id,
|
||||||
collection_class=OrderedSet)
|
collection_class=OrderedSet)
|
||||||
|
@ -161,10 +162,7 @@ class Event(Thing):
|
||||||
"""
|
"""
|
||||||
parent_id = Column(BigInteger, ForeignKey(Computer.id))
|
parent_id = Column(BigInteger, ForeignKey(Computer.id))
|
||||||
parent = relationship(Computer,
|
parent = relationship(Computer,
|
||||||
backref=backref('events_parent',
|
backref=backref('events_parent', lazy=True, **_sorted_events),
|
||||||
lazy=True,
|
|
||||||
order_by=lambda: Event.created,
|
|
||||||
collection_class=OrderedSet),
|
|
||||||
primaryjoin=parent_id == Computer.id)
|
primaryjoin=parent_id == Computer.id)
|
||||||
parent_id.comment = """
|
parent_id.comment = """
|
||||||
For events that are performed to components, the device parent
|
For events that are performed to components, the device parent
|
||||||
|
@ -227,7 +225,18 @@ class Event(Thing):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def date_str(self):
|
def date_str(self):
|
||||||
return '{:%c}'.format(self.end_time or self.created)
|
return '{:%c}'.format(self.end_time)
|
||||||
|
|
||||||
|
def __init__(self, **kwargs) -> None:
|
||||||
|
# sortedset forces us to do this before calling our parent init
|
||||||
|
self.end_time = kwargs.get('end_time', None)
|
||||||
|
if not self.end_time:
|
||||||
|
# Set default for end_time, make it the same of created
|
||||||
|
kwargs['created'] = self.end_time = datetime.now(timezone.utc)
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
return self.end_time < other.end_time
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return '{}'.format(self.severity)
|
return '{}'.format(self.severity)
|
||||||
|
@ -254,8 +263,7 @@ class EventWithOneDevice(JoinedTableMixin, Event):
|
||||||
backref=backref('events_one',
|
backref=backref('events_one',
|
||||||
lazy=True,
|
lazy=True,
|
||||||
cascade=CASCADE_OWN,
|
cascade=CASCADE_OWN,
|
||||||
order_by=lambda: EventWithOneDevice.created,
|
**_sorted_events),
|
||||||
collection_class=OrderedSet),
|
|
||||||
primaryjoin=Device.id == device_id)
|
primaryjoin=Device.id == device_id)
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
@ -282,10 +290,7 @@ class EventWithOneDevice(JoinedTableMixin, Event):
|
||||||
|
|
||||||
class EventWithMultipleDevices(Event):
|
class EventWithMultipleDevices(Event):
|
||||||
devices = relationship(Device,
|
devices = relationship(Device,
|
||||||
backref=backref('events_multiple',
|
backref=backref('events_multiple', lazy=True, **_sorted_events),
|
||||||
lazy=True,
|
|
||||||
order_by=lambda: EventWithMultipleDevices.created,
|
|
||||||
collection_class=OrderedSet),
|
|
||||||
secondary=lambda: EventDevice.__table__,
|
secondary=lambda: EventDevice.__table__,
|
||||||
order_by=lambda: Device.id,
|
order_by=lambda: Device.id,
|
||||||
collection_class=OrderedSet)
|
collection_class=OrderedSet)
|
||||||
|
@ -1292,10 +1297,7 @@ class Trade(JoinedTableMixin, EventWithMultipleDevices):
|
||||||
to_id = Column(UUID(as_uuid=True), ForeignKey(Agent.id), nullable=False)
|
to_id = Column(UUID(as_uuid=True), ForeignKey(Agent.id), nullable=False)
|
||||||
# todo compute the org
|
# todo compute the org
|
||||||
to = relationship(Agent,
|
to = relationship(Agent,
|
||||||
backref=backref('events_to',
|
backref=backref('events_to', lazy=True, **_sorted_events),
|
||||||
lazy=True,
|
|
||||||
collection_class=OrderedSet,
|
|
||||||
order_by=lambda: Event.created),
|
|
||||||
primaryjoin=to_id == Agent.id)
|
primaryjoin=to_id == Agent.id)
|
||||||
to_comment = """
|
to_comment = """
|
||||||
The agent that gets the device due this deal.
|
The agent that gets the device due this deal.
|
||||||
|
|
|
@ -32,6 +32,7 @@ class Thing(db.Model):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs) -> None:
|
def __init__(self, **kwargs) -> None:
|
||||||
|
# We need to set 'created' before sqlalchemy inits the class
|
||||||
|
# to be able to use sorted containers
|
||||||
|
self.created = kwargs.get('created', datetime.now(timezone.utc))
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
if not self.created:
|
|
||||||
self.created = datetime.now(timezone.utc)
|
|
||||||
|
|
|
@ -31,3 +31,4 @@ sqlalchemy-citext==1.3.post0
|
||||||
flask-weasyprint==0.5
|
flask-weasyprint==0.5
|
||||||
weasyprint==44
|
weasyprint==44
|
||||||
psycopg2-binary==2.7.5
|
psycopg2-binary==2.7.5
|
||||||
|
sortedcontainers==2.1.0
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -40,7 +40,8 @@ setup(
|
||||||
'requests-toolbelt',
|
'requests-toolbelt',
|
||||||
'sqlalchemy-citext',
|
'sqlalchemy-citext',
|
||||||
'sqlalchemy-utils[password, color, phone]',
|
'sqlalchemy-utils[password, color, phone]',
|
||||||
'Flask-WeasyPrint'
|
'Flask-WeasyPrint',
|
||||||
|
'sortedcontainers'
|
||||||
],
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
'docs': [
|
'docs': [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": true,
|
"closed": true,
|
||||||
"endTime": "2018-07-19T15:48:40.635776",
|
"endTime": "2018-07-19T15:48:40.635776+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Dell Inc.",
|
"manufacturer": "Dell Inc.",
|
||||||
"model": "Latitude E6440",
|
"model": "Latitude E6440",
|
||||||
|
@ -15,132 +15,132 @@
|
||||||
"chassis": "Laptop"
|
"chassis": "Laptop"
|
||||||
},
|
},
|
||||||
"components": [
|
"components": [
|
||||||
|
{
|
||||||
|
"manufacturer": "Intel Corp.",
|
||||||
|
"model": "Intel Core i7-4600M CPU @ 2.90GHz",
|
||||||
|
"serialNumber": null,
|
||||||
|
"events": [
|
||||||
{
|
{
|
||||||
"manufacturer": "Intel Corp.",
|
"elapsed": 165,
|
||||||
"model": "Intel Core i7-4600M CPU @ 2.90GHz",
|
"rate": 164.8342,
|
||||||
"serialNumber": null,
|
"type": "BenchmarkProcessorSysbench"
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"elapsed": 165,
|
|
||||||
"rate": 164.8342,
|
|
||||||
"type": "BenchmarkProcessorSysbench"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"elapsed": 0,
|
|
||||||
"rate": 6665.7,
|
|
||||||
"type": "BenchmarkProcessor"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"type": "Processor",
|
|
||||||
"speed": 1.259899,
|
|
||||||
"address": 64,
|
|
||||||
"cores": 2,
|
|
||||||
"threads": 4
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"manufacturer": "Samsung",
|
"elapsed": 0,
|
||||||
"model": "M471B5173DB0-YK0",
|
"rate": 6665.7,
|
||||||
"serialNumber": "732CD498",
|
"type": "BenchmarkProcessor"
|
||||||
"events": [],
|
|
||||||
"type": "RamModule",
|
|
||||||
"format": "SODIMM",
|
|
||||||
"size": 4096,
|
|
||||||
"interface": "DDR3",
|
|
||||||
"speed": 1600.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Samsung",
|
|
||||||
"model": "M471B5173DB0-YK0",
|
|
||||||
"serialNumber": "152DD498",
|
|
||||||
"events": [],
|
|
||||||
"type": "RamModule",
|
|
||||||
"format": "SODIMM",
|
|
||||||
"size": 4096,
|
|
||||||
"interface": "DDR3",
|
|
||||||
"speed": 1600.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": null,
|
|
||||||
"model": "Crucial_CT525MX3",
|
|
||||||
"serialNumber": "164014297BCC",
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"readSpeed": 63.3,
|
|
||||||
"type": "BenchmarkDataStorage",
|
|
||||||
"elapsed": 18,
|
|
||||||
"writeSpeed": 20.1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"type": "HardDrive",
|
|
||||||
"size": 500786,
|
|
||||||
"interface": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Intel Corporation",
|
|
||||||
"model": "4th Gen Core Processor Integrated Graphics Controller",
|
|
||||||
"serialNumber": null,
|
|
||||||
"events": [],
|
|
||||||
"type": "GraphicCard",
|
|
||||||
"memory": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Intel Corporation",
|
|
||||||
"model": "Ethernet Connection I217-LM",
|
|
||||||
"serialNumber": "ec:f4:bb:0b:18:90",
|
|
||||||
"events": [],
|
|
||||||
"type": "NetworkAdapter",
|
|
||||||
"speed": 1000,
|
|
||||||
"wireless": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Intel Corporation",
|
|
||||||
"model": "Centrino Advanced-N 6235",
|
|
||||||
"serialNumber": "c4:d9:87:47:90:e1",
|
|
||||||
"events": [],
|
|
||||||
"type": "NetworkAdapter",
|
|
||||||
"wireless": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": null,
|
|
||||||
"model": null,
|
|
||||||
"serialNumber": "da:b4:3a:25:88:6c",
|
|
||||||
"events": [],
|
|
||||||
"type": "NetworkAdapter",
|
|
||||||
"wireless": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Intel Corporation",
|
|
||||||
"model": "Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller",
|
|
||||||
"serialNumber": null,
|
|
||||||
"events": [],
|
|
||||||
"type": "SoundCard"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "CNFCH52J48303+YF2",
|
|
||||||
"model": "Laptop_Integrated_Webcam_HD",
|
|
||||||
"serialNumber": null,
|
|
||||||
"events": [],
|
|
||||||
"type": "SoundCard"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Intel Corporation",
|
|
||||||
"model": "8 Series/C220 Series Chipset High Definition Audio Controller",
|
|
||||||
"serialNumber": null,
|
|
||||||
"events": [],
|
|
||||||
"type": "SoundCard"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"manufacturer": "Dell Inc.",
|
|
||||||
"model": "0159N7",
|
|
||||||
"serialNumber": "/FJBQVZ1/CN1296342I009B/",
|
|
||||||
"events": [],
|
|
||||||
"type": "Motherboard",
|
|
||||||
"usb": 3,
|
|
||||||
"firewire": 0,
|
|
||||||
"serial": 1,
|
|
||||||
"pcmcia": 0,
|
|
||||||
"slots": 1
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"type": "Processor",
|
||||||
|
"speed": 1.259899,
|
||||||
|
"address": 64,
|
||||||
|
"cores": 2,
|
||||||
|
"threads": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Samsung",
|
||||||
|
"model": "M471B5173DB0-YK0",
|
||||||
|
"serialNumber": "732CD498",
|
||||||
|
"events": [],
|
||||||
|
"type": "RamModule",
|
||||||
|
"format": "SODIMM",
|
||||||
|
"size": 4096,
|
||||||
|
"interface": "DDR3",
|
||||||
|
"speed": 1600.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Samsung",
|
||||||
|
"model": "M471B5173DB0-YK0",
|
||||||
|
"serialNumber": "152DD498",
|
||||||
|
"events": [],
|
||||||
|
"type": "RamModule",
|
||||||
|
"format": "SODIMM",
|
||||||
|
"size": 4096,
|
||||||
|
"interface": "DDR3",
|
||||||
|
"speed": 1600.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": null,
|
||||||
|
"model": "Crucial_CT525MX3",
|
||||||
|
"serialNumber": "164014297BCC",
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"readSpeed": 63.3,
|
||||||
|
"type": "BenchmarkDataStorage",
|
||||||
|
"elapsed": 18,
|
||||||
|
"writeSpeed": 20.1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "HardDrive",
|
||||||
|
"size": 500786,
|
||||||
|
"interface": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"model": "4th Gen Core Processor Integrated Graphics Controller",
|
||||||
|
"serialNumber": null,
|
||||||
|
"events": [],
|
||||||
|
"type": "GraphicCard",
|
||||||
|
"memory": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"model": "Ethernet Connection I217-LM",
|
||||||
|
"serialNumber": "ec:f4:bb:0b:18:90",
|
||||||
|
"events": [],
|
||||||
|
"type": "NetworkAdapter",
|
||||||
|
"speed": 1000,
|
||||||
|
"wireless": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"model": "Centrino Advanced-N 6235",
|
||||||
|
"serialNumber": "c4:d9:87:47:90:e1",
|
||||||
|
"events": [],
|
||||||
|
"type": "NetworkAdapter",
|
||||||
|
"wireless": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": null,
|
||||||
|
"model": null,
|
||||||
|
"serialNumber": "da:b4:3a:25:88:6c",
|
||||||
|
"events": [],
|
||||||
|
"type": "NetworkAdapter",
|
||||||
|
"wireless": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"model": "Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller",
|
||||||
|
"serialNumber": null,
|
||||||
|
"events": [],
|
||||||
|
"type": "SoundCard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "CNFCH52J48303+YF2",
|
||||||
|
"model": "Laptop_Integrated_Webcam_HD",
|
||||||
|
"serialNumber": null,
|
||||||
|
"events": [],
|
||||||
|
"type": "SoundCard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"model": "8 Series/C220 Series Chipset High Definition Audio Controller",
|
||||||
|
"serialNumber": null,
|
||||||
|
"events": [],
|
||||||
|
"type": "SoundCard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"manufacturer": "Dell Inc.",
|
||||||
|
"model": "0159N7",
|
||||||
|
"serialNumber": "/FJBQVZ1/CN1296342I009B/",
|
||||||
|
"events": [],
|
||||||
|
"type": "Motherboard",
|
||||||
|
"usb": 3,
|
||||||
|
"firewire": 0,
|
||||||
|
"serial": 1,
|
||||||
|
"pcmcia": 0,
|
||||||
|
"slots": 1
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"elapsed": 0
|
"elapsed": 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,19 +70,19 @@
|
||||||
"type": "HardDrive",
|
"type": "HardDrive",
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"endTime": "2018-07-13T11:54:55.100581",
|
"endTime": "2018-07-13T11:54:55.100581+00:00",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"endTime": "2018-07-13T11:54:55.096491",
|
"endTime": "2018-07-13T11:54:55.096491+00:00",
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"startTime": "2018-07-13T10:52:45.092981"
|
"startTime": "2018-07-13T10:52:45.092981+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
|
|
||||||
"startTime": "2018-07-13T10:52:45.092612"
|
"startTime": "2018-07-13T10:52:45.092612+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lifetime": 24658,
|
"lifetime": 24658,
|
||||||
|
@ -114,18 +114,18 @@
|
||||||
"type": "HardDrive",
|
"type": "HardDrive",
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"endTime": "2018-07-13T12:55:47.331586",
|
"endTime": "2018-07-13T12:55:47.331586+00:00",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"endTime": "2018-07-13T12:55:47.326835",
|
"endTime": "2018-07-13T12:55:47.326835+00:00",
|
||||||
"type": "StepRandom",
|
"type": "StepRandom",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"startTime": "2018-07-13T11:54:55.100925"
|
"startTime": "2018-07-13T11:54:55.100925+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "EraseBasic",
|
"type": "EraseBasic",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"startTime": "2018-07-13T11:54:55.100667"
|
"startTime": "2018-07-13T11:54:55.100667+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lifetime": 21979,
|
"lifetime": 21979,
|
||||||
|
@ -170,5 +170,5 @@
|
||||||
"serialNumber": "109192430003459"
|
"serialNumber": "109192430003459"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"endTime": "2018-07-13T10:48:36.738398"
|
"endTime": "2018-07-13T10:48:36.738398+00:00"
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,6 @@
|
||||||
},
|
},
|
||||||
"type": "Snapshot",
|
"type": "Snapshot",
|
||||||
"software": "Workbench",
|
"software": "Workbench",
|
||||||
"endTime": "2018-07-19T15:48:40.635776",
|
"endTime": "2018-07-19T15:48:40.635776+00:00",
|
||||||
"closed": false
|
"closed": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@ type: 'EraseSectors'
|
||||||
severity: Info
|
severity: Info
|
||||||
# snapshot: None fulfill!
|
# snapshot: None fulfill!
|
||||||
# device: None fulfill!
|
# device: None fulfill!
|
||||||
startTime: 2018-01-01T10:10:10
|
startTime: '2018-01-01T10:10:10+00:00'
|
||||||
endTime: 2018-01-01T12:10:10
|
endTime: '2018-01-01T12:10:10+00:00'
|
||||||
steps:
|
steps:
|
||||||
- type: 'StepRandom'
|
- type: 'StepRandom'
|
||||||
startTime: '2018-01-01T10:10:10'
|
startTime: '2018-01-01T10:10:10+00:00'
|
||||||
endTime: '2018-01-01T12:10:10'
|
endTime: '2018-01-01T12:10:10+00:00'
|
||||||
severity: Info
|
severity: Info
|
||||||
|
|
|
@ -157,7 +157,8 @@ def test_snapshot_component_add_remove(user: UserClient):
|
||||||
# p1c2s has two Snapshots, a Remove and an Add
|
# p1c2s has two Snapshots, a Remove and an Add
|
||||||
p1c2s, _ = user.get(res=m.Device, item=pc2['components'][0]['id'])
|
p1c2s, _ = user.get(res=m.Device, item=pc2['components'][0]['id'])
|
||||||
assert tuple(e['type'] for e in p1c2s['events']) == (
|
assert tuple(e['type'] for e in p1c2s['events']) == (
|
||||||
'BenchmarkProcessor', 'Snapshot', 'Snapshot', 'Remove')
|
'BenchmarkProcessor', 'Snapshot', 'Snapshot', 'Remove'
|
||||||
|
)
|
||||||
|
|
||||||
# We register the first device again, but removing motherboard
|
# We register the first device again, but removing motherboard
|
||||||
# and moving processor from the second device to the first.
|
# and moving processor from the second device to the first.
|
||||||
|
@ -304,31 +305,43 @@ def test_snapshot_component_containing_components(user: UserClient):
|
||||||
user.post(s, res=Snapshot, status=ValidationError)
|
user.post(s, res=Snapshot, status=ValidationError)
|
||||||
|
|
||||||
|
|
||||||
def test_erase_privacy_standards(user: UserClient):
|
def test_erase_privacy_standards_endtime_sort(user: UserClient):
|
||||||
"""Tests a Snapshot with EraseSectors and the resulting
|
"""Tests a Snapshot with EraseSectors and the resulting privacy
|
||||||
privacy properties.
|
properties.
|
||||||
|
|
||||||
|
This tests ensures that only the last erasure is picked up, as
|
||||||
|
erasures have always custom endTime value set.
|
||||||
"""
|
"""
|
||||||
s = file('erase-sectors.snapshot')
|
s = file('erase-sectors.snapshot')
|
||||||
assert '2018-06-01T09:12:06+02:00' == s['components'][0]['events'][0]['endTime']
|
assert s['components'][0]['events'][0]['endTime'] == '2018-06-01T09:12:06+02:00'
|
||||||
snapshot = snapshot_and_check(user, s, event_types=(
|
snapshot = snapshot_and_check(user, s, event_types=(
|
||||||
EraseSectors.t,
|
EraseSectors.t,
|
||||||
BenchmarkDataStorage.t,
|
BenchmarkDataStorage.t,
|
||||||
BenchmarkProcessor.t
|
BenchmarkProcessor.t
|
||||||
))
|
), perform_second_snapshot=False)
|
||||||
|
# Perform a new snapshot changing the erasure time, as if
|
||||||
|
# it is a new erasure performed after.
|
||||||
erase = next(e for e in snapshot['events'] if e['type'] == EraseSectors.t)
|
erase = next(e for e in snapshot['events'] if e['type'] == EraseSectors.t)
|
||||||
assert '2018-06-01T07:12:06+00:00' == erase['endTime']
|
assert erase['endTime'] == '2018-06-01T07:12:06+00:00'
|
||||||
|
s['uuid'] = uuid4()
|
||||||
|
s['components'][0]['events'][0]['endTime'] = '2018-06-01T07:14:00+00:00'
|
||||||
|
snapshot = snapshot_and_check(user, s, event_types=(
|
||||||
|
EraseSectors.t,
|
||||||
|
BenchmarkDataStorage.t,
|
||||||
|
BenchmarkProcessor.t
|
||||||
|
), perform_second_snapshot=False)
|
||||||
|
|
||||||
|
# The actual test
|
||||||
storage = next(e for e in snapshot['components'] if e['type'] == SolidStateDrive.t)
|
storage = next(e for e in snapshot['components'] if e['type'] == SolidStateDrive.t)
|
||||||
storage, _ = user.get(res=m.Device, item=storage['id']) # Let's get storage events too
|
storage, _ = user.get(res=m.Device, item=storage['id']) # Let's get storage events too
|
||||||
# order: creation time ascending
|
# order: endTime ascending
|
||||||
erasure1, benchmark_data_storage1, _snapshot1, erasure2, benchmark_data_storage2, _snapshot2 = \
|
# erasure1/2 have an user defined time and others events endTime = created
|
||||||
storage['events']
|
erasure1, erasure2, benchmark_hdd1, _snapshot1, benchmark_hdd2, _snapshot2 = storage['events']
|
||||||
assert erasure1['type'] == erasure2['type'] == 'EraseSectors'
|
assert erasure1['type'] == erasure2['type'] == 'EraseSectors'
|
||||||
assert benchmark_data_storage1['type'] == benchmark_data_storage2[
|
assert benchmark_hdd1['type'] == benchmark_hdd2['type'] == 'BenchmarkDataStorage'
|
||||||
'type'] == 'BenchmarkDataStorage'
|
|
||||||
assert _snapshot1['type'] == _snapshot2['type'] == 'Snapshot'
|
assert _snapshot1['type'] == _snapshot2['type'] == 'Snapshot'
|
||||||
get_snapshot, _ = user.get(res=Event, item=_snapshot2['id'])
|
get_snapshot, _ = user.get(res=Event, item=_snapshot2['id'])
|
||||||
assert get_snapshot['events'][0]['endTime'] == '2018-06-01T07:12:06+00:00'
|
assert get_snapshot['events'][0]['endTime'] == '2018-06-01T07:14:00+00:00'
|
||||||
# TODO events order are different between snapshots
|
|
||||||
assert snapshot == get_snapshot
|
assert snapshot == get_snapshot
|
||||||
erasure, _ = user.get(res=Event, item=erasure1['id'])
|
erasure, _ = user.get(res=Event, item=erasure1['id'])
|
||||||
assert len(erasure['steps']) == 2
|
assert len(erasure['steps']) == 2
|
||||||
|
|
|
@ -36,7 +36,6 @@ def test_workbench_server_condensed(user: UserClient):
|
||||||
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
||||||
events = snapshot['events']
|
events = snapshot['events']
|
||||||
assert {(event['type'], event['device']) for event in events} == {
|
assert {(event['type'], event['device']) for event in events} == {
|
||||||
('RateComputer', 1),
|
|
||||||
('BenchmarkProcessorSysbench', 5),
|
('BenchmarkProcessorSysbench', 5),
|
||||||
('StressTest', 1),
|
('StressTest', 1),
|
||||||
('EraseSectors', 6),
|
('EraseSectors', 6),
|
||||||
|
@ -47,7 +46,8 @@ def test_workbench_server_condensed(user: UserClient):
|
||||||
('BenchmarkDataStorage', 6),
|
('BenchmarkDataStorage', 6),
|
||||||
('BenchmarkDataStorage', 7),
|
('BenchmarkDataStorage', 7),
|
||||||
('TestDataStorage', 6),
|
('TestDataStorage', 6),
|
||||||
('VisualTest', 1)
|
('VisualTest', 1),
|
||||||
|
('RateComputer', 1)
|
||||||
}
|
}
|
||||||
assert snapshot['closed']
|
assert snapshot['closed']
|
||||||
assert snapshot['severity'] == 'Info'
|
assert snapshot['severity'] == 'Info'
|
||||||
|
@ -63,9 +63,9 @@ def test_workbench_server_condensed(user: UserClient):
|
||||||
assert device['rate']['severity'] == 'Info'
|
assert device['rate']['severity'] == 'Info'
|
||||||
assert device['rate']['rating'] == 0
|
assert device['rate']['rating'] == 0
|
||||||
assert device['rate']['type'] == 'RateComputer'
|
assert device['rate']['type'] == 'RateComputer'
|
||||||
assert device['events'][0]['appearanceRange'] == 'A'
|
assert device['events'][2]['type'] == 'VisualTest'
|
||||||
assert device['events'][0]['functionalityRange'] == 'B'
|
assert device['events'][2]['appearanceRange'] == 'A'
|
||||||
|
assert device['events'][2]['functionalityRange'] == 'B'
|
||||||
assert device['tags'][0]['id'] == 'tag1'
|
assert device['tags'][0]['id'] == 'tag1'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Acer",
|
"manufacturer": "Acer",
|
||||||
"model": "Aspire 5737Z",
|
"model": "Aspire 5737Z",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "ASUS",
|
"manufacturer": "ASUS",
|
||||||
"model": "All Series",
|
"model": "All Series",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "ASUS",
|
"manufacturer": "ASUS",
|
||||||
"model": "All Series",
|
"model": "All Series",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": null,
|
"manufacturer": null,
|
||||||
"model": null,
|
"model": null,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": null,
|
"manufacturer": null,
|
||||||
"model": null,
|
"model": null,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "ASUS",
|
"manufacturer": "ASUS",
|
||||||
"model": "All Series",
|
"model": "All Series",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Dell Inc.",
|
"manufacturer": "Dell Inc.",
|
||||||
"model": "Latitude E5530 non-vPro",
|
"model": "Latitude E5530 non-vPro",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": null,
|
"manufacturer": null,
|
||||||
"model": null,
|
"model": null,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "ASUS",
|
"manufacturer": "ASUS",
|
||||||
"model": "All Series",
|
"model": "All Series",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "ASUSTeK Computer INC.",
|
"manufacturer": "ASUSTeK Computer INC.",
|
||||||
"model": "1000H",
|
"model": "1000H",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Hewlett-Packard",
|
"manufacturer": "Hewlett-Packard",
|
||||||
"model": "HP Compaq dc7900 Small Form Factor",
|
"model": "HP Compaq dc7900 Small Form Factor",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Hewlett-Packard",
|
"manufacturer": "Hewlett-Packard",
|
||||||
"model": "HP Compaq 8100 Elite SFF",
|
"model": "HP Compaq 8100 Elite SFF",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Hewlett-Packard",
|
"manufacturer": "Hewlett-Packard",
|
||||||
"model": "Pavilion dv4000",
|
"model": "Pavilion dv4000",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "LENOVO",
|
"manufacturer": "LENOVO",
|
||||||
"model": "7220W3T",
|
"model": "7220W3T",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "LENOVO",
|
"manufacturer": "LENOVO",
|
||||||
"model": "7220W3T",
|
"model": "7220W3T",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "LENOVO",
|
"manufacturer": "LENOVO",
|
||||||
"model": "3493BAG",
|
"model": "3493BAG",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "LENOVO",
|
"manufacturer": "LENOVO",
|
||||||
"model": "7220W3T",
|
"model": "7220W3T",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "NEC Computers SAS",
|
"manufacturer": "NEC Computers SAS",
|
||||||
"model": "Powermate MLxxx",
|
"model": "Powermate MLxxx",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": null,
|
"manufacturer": null,
|
||||||
"model": null,
|
"model": null,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Dell Inc.",
|
"manufacturer": "Dell Inc.",
|
||||||
"model": "OptiPlex 745",
|
"model": "OptiPlex 745",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Dell Inc.",
|
"manufacturer": "Dell Inc.",
|
||||||
"model": "OptiPlex GX520",
|
"model": "OptiPlex GX520",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Hewlett-Packard",
|
"manufacturer": "Hewlett-Packard",
|
||||||
"model": "HP Compaq dc7900 Small Form Factor",
|
"model": "HP Compaq dc7900 Small Form Factor",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "TOSHIBA",
|
"manufacturer": "TOSHIBA",
|
||||||
"model": "PORTEGE R700",
|
"model": "PORTEGE R700",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "innotek GmbH",
|
"manufacturer": "innotek GmbH",
|
||||||
"model": "VirtualBox",
|
"model": "VirtualBox",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "innotek GmbH",
|
"manufacturer": "innotek GmbH",
|
||||||
"model": "VirtualBox",
|
"model": "VirtualBox",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "innotek GmbH",
|
"manufacturer": "innotek GmbH",
|
||||||
"model": "VirtualBox",
|
"model": "VirtualBox",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Dell Inc.",
|
"manufacturer": "Dell Inc.",
|
||||||
"model": "Vostro 260",
|
"model": "Vostro 260",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "LENOVO",
|
"manufacturer": "LENOVO",
|
||||||
"model": "415522G",
|
"model": "415522G",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "11.0a1",
|
"version": "11.0a1",
|
||||||
"expectedEvents": [],
|
"expectedEvents": [],
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"endTime": "2000-01-01 00:00:00",
|
"endTime": "2000-01-01 00:00:00+00:00",
|
||||||
"device": {
|
"device": {
|
||||||
"manufacturer": "Timi",
|
"manufacturer": "Timi",
|
||||||
"model": "TM1613",
|
"model": "TM1613",
|
||||||
|
|
Reference in New Issue