diff --git a/ereuse_devicehub/resources/documents/templates/documents/erasure.html b/ereuse_devicehub/resources/documents/templates/documents/erasure.html
index b2556500..d8170767 100644
--- a/ereuse_devicehub/resources/documents/templates/documents/erasure.html
+++ b/ereuse_devicehub/resources/documents/templates/documents/erasure.html
@@ -5,8 +5,6 @@
- S/N |
- Tags |
S/N Data Storage |
Type of erasure |
Result |
@@ -16,16 +14,6 @@
{% for erasure in erasures %}
- {% if erasure.parent.serial_number %}
-
- {{ erasure.parent.serial_number.upper() }}
- |
- {% else %}
- |
- {% endif %}
-
- {{ erasure.parent.tags.__format__('') }}
- |
{{ erasure.device.serial_number.upper() }}
|
@@ -51,10 +39,19 @@
- Data storage:
- {{ erasure.device.__format__('ts') }}
- - Computer:
- - {{ erasure.parent.__format__('ts') }}
- - Tags:
- - {{ erasure.parent.tags }}
+
+ - Computer where was erase:
+ - Title: {{ erasure.parent.__format__('ts') }}
+ - SystemId: {{ erasure.parent.id }}
+ - Hid: {{ erasure.parent.hid }}
+ - Tags: {{ erasure.parent.tags }}
+
+ - Computer where it resides:
+ - Title: {{ erasure.device.parent.__format__('ts') }}
+ - SystemId: {{ erasure.device.parent.id }}
+ - Hid: {{ erasure.device.parent.hid }}
+ - Tags: {{ erasure.device.parent.tags }}
+
- Erasure:
- {{ erasure.__format__('ts') }}
{% if erasure.steps %}
diff --git a/tests/files/erase-sectors-2-hdd.snapshot2.yaml b/tests/files/erase-sectors-2-hdd.snapshot2.yaml
new file mode 100644
index 00000000..9c3da624
--- /dev/null
+++ b/tests/files/erase-sectors-2-hdd.snapshot2.yaml
@@ -0,0 +1,141 @@
+{
+ "version": "11.0a3",
+ "device": {
+ "serialNumber": 'fooz',
+ "manufacturer": 'bar',
+ "model": 'baz',
+ "type": "Desktop",
+ "actions": [],
+ "chassis": "Tower"
+ },
+ "elapsed": 7631,
+ "software": "Workbench",
+ "type": "Snapshot",
+ "closed": false,
+ "uuid": "5387668a-8d21-4053-a1ac-36efb97fc4ea",
+ "components": [
+ {
+ "serialNumber": null,
+ "threads": 2,
+ "manufacturer": "Intel Corp.",
+ "address": 64,
+ "model": "Intel Core i3-2100 CPU @ 3.10GHz",
+ "type": "Processor",
+ "actions": [
+ {
+ "elapsed": 0,
+ "rate": 6665.7,
+ "type": "BenchmarkProcessor"
+ }
+ ],
+ "cores": 2,
+ "speed": 1.6071410000000002
+ },
+ {
+ "manufacturer": "Intel Corporation",
+ "model": "6 Series/C200 Series Chipset Family High Definition Audio Controller",
+ "type": "SoundCard",
+ "actions": [],
+ "serialNumber": null
+ },
+ {
+ "serialNumber": "8F179435",
+ "size": 4096,
+ "manufacturer": "Kingston",
+ "format": "DIMM",
+ "model": "9905403-038.A00LF",
+ "type": "RamModule",
+ "actions": [],
+ "interface": "DDR3",
+ "speed": 1333.0
+ },
+ {
+ "manufacturer": "Realtek Semiconductor Co., Ltd.",
+ "model": "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller",
+ "type": "NetworkAdapter",
+ "actions": [],
+ "serialNumber": "f4:6d:04:12:9b:85",
+ "speed": 1000,
+ "wireless": false
+ },
+ {
+ "serialNumber": "WD-WCAV29008961",
+ "size": 305245,
+ "manufacturer": "Western Digital",
+ "model": "WDC WD3200AAJS-2",
+ "type": "HardDrive",
+ "actions": [
+ {
+ "lifetime": 24658,
+ "assessment": false,
+ "elapsed": 131,
+ "length": "Short",
+ "offlineUncorrectable": 1,
+ "severity": "Error",
+ "currentPendingSectorCount": 1,
+ "powerCycleCount": 1253,
+ "reallocatedSectorCount": 15,
+ "type": "TestDataStorage",
+ "status": "Completed: read failure"
+ },
+ {
+ "readSpeed": 63.3,
+ "type": "BenchmarkDataStorage",
+ "elapsed": 18,
+ "writeSpeed": 20.1
+ }
+ ],
+ "interface": "ATA"
+ },
+ {
+ "serialNumber": "WD-WCAV27984668",
+ "size": 305245,
+ "manufacturer": "Western Digital",
+ "model": "WDC WD3200AAJS-0",
+ "type": "HardDrive",
+ "actions": [
+ {
+ "lifetime": 21979,
+ "assessment": true,
+ "elapsed": 115,
+ "length": "Short",
+ "offlineUncorrectable": 0,
+ "severity": "Info",
+ "currentPendingSectorCount": 0,
+ "powerCycleCount": 1956,
+ "reallocatedSectorCount": 0,
+ "type": "TestDataStorage",
+ "status": "Completed without error"
+ },
+ {
+ "readSpeed": 63.3,
+ "type": "BenchmarkDataStorage",
+ "elapsed": 18,
+ "writeSpeed": 20.1
+ }
+ ],
+ "interface": "ATA"
+ },
+ {
+ "serialNumber": null,
+ "manufacturer": "Intel Corporation",
+ "model": "2nd Generation Core Processor Family Integrated Graphics Controller",
+ "type": "GraphicCard",
+ "actions": [],
+ "memory": 256.0
+ },
+ {
+ "pcmcia": 0,
+ "serial": 1,
+ "manufacturer": "ASUSTeK Computer INC.",
+ "model": "P8H61-M LE",
+ "type": "Motherboard",
+ "actions": [],
+ "slots": 2,
+ "usb": 2,
+ "firewire": 0,
+ "serialNumber": "109192430003458"
+ }
+ ],
+ "endTime": "2018-07-13T10:48:36.738398+00:00"
+}
diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py
index c9cf5084..9de3c1a4 100644
--- a/tests/test_snapshot.py
+++ b/tests/test_snapshot.py
@@ -13,6 +13,7 @@ from uuid import uuid4
from boltons import urlutils
from teal.db import UniqueViolation, DBError
from teal.marshmallow import ValidationError
+from ereuse_utils.test import ANY
from ereuse_devicehub.client import UserClient
from ereuse_devicehub.db import db
@@ -29,7 +30,9 @@ from ereuse_devicehub.resources.enums import ComputerChassis, SnapshotSoftware
from ereuse_devicehub.resources.tag import Tag
from ereuse_devicehub.resources.user.models import User
from ereuse_devicehub.resources.action.views import save_json
+from ereuse_devicehub.resources.documents import documents
from tests.conftest import file
+from tests import conftest
@pytest.mark.mvp
@@ -542,6 +545,32 @@ def snapshot_and_check(user: UserClient,
return snapshot
+@pytest.mark.mvp
+@pytest.mark.usefixtures(conftest.app_context.__name__)
+def test_erase_changing_hdd_between_pcs(user: UserClient):
+ """Tests when we erase one device and next change the disk in other device we
+ want see in the second device the disks erase."""
+ s1 = file('erase-sectors-2-hdd.snapshot')
+ s2 = file('erase-sectors-2-hdd.snapshot2')
+ snapshot1, _ = user.post(res=Snapshot, data=s1)
+ snapshot2, _ = user.post(res=Snapshot, data=s2)
+ dev1 = m.Device.query.filter_by(id=snapshot1['device']['id']).one()
+ dev2 = m.Device.query.filter_by(id=snapshot2['device']['id']).one()
+ tag1 = Tag(id='dev1', device=dev1)
+ tag2 = Tag(id='dev2', device=dev2)
+ db.session.commit()
+
+ assert dev2.components[1].actions[2].parent == dev1
+ doc1, response = user.get(res=documents.DocumentDef.t,
+ item='erasures/{}'.format(dev1.id),
+ accept=ANY)
+ doc2, response = user.get(res=documents.DocumentDef.t,
+ item='erasures/{}'.format(dev2.id),
+ accept=ANY)
+ assert 'dev1' in doc2
+ assert 'dev2' in doc2
+
+
@pytest.mark.mvp
@pytest.mark.xfail(reason='Debug and rewrite it')
def test_pc_rating_rate_none(user: UserClient):
@@ -557,6 +586,7 @@ def test_pc_2(user: UserClient):
snapshot, _ = user.post(res=Snapshot, data=s)
+
@pytest.mark.mvp
def test_save_snapshot_in_file(app: Devicehub, user: UserClient):
""" This test check if works the function save_snapshot_in_file """