Merge pull request #419 from eReuse/feature/3999-setings
Feature/3999 fix setings_version and template
This commit is contained in:
commit
14b61cbaeb
|
@ -90,7 +90,9 @@ class SnapshotsLog(Thing):
|
|||
settings_version = self.snapshot.settings_version or ''
|
||||
settings_version = "".join([x[0] for x in settings_version.split(' ') if x])
|
||||
|
||||
return "{} ({})".format(self.version, settings_version)
|
||||
if settings_version:
|
||||
return "{} ({})".format(self.version, settings_version)
|
||||
return "{}".format(self.version)
|
||||
|
||||
|
||||
class PlaceholdersLog(Thing):
|
||||
|
|
|
@ -343,6 +343,7 @@ class ParseSnapshotLsHw:
|
|||
"components": self.components,
|
||||
"uuid": snapshot['uuid'],
|
||||
"version": "14.0.0",
|
||||
"settings_version": snapshot.get("settings_version"),
|
||||
"endTime": snapshot["timestamp"],
|
||||
"elapsed": 1,
|
||||
"sid": snapshot["sid"],
|
||||
|
|
|
@ -22,6 +22,7 @@ class Snapshot_lite(Thing):
|
|||
sid = String(required=True)
|
||||
type = String(required=True)
|
||||
timestamp = String(required=True)
|
||||
settings_version = String(required=False)
|
||||
data = Nested(Snapshot_lite_data, required=True)
|
||||
|
||||
@validates_schema
|
||||
|
|
|
@ -14,7 +14,7 @@ WB_SMART_TEST = short
|
|||
WB_ERASE = EraseBasic
|
||||
WB_ERASE_STEPS = 1
|
||||
WB_ERASE_LEADING_ZEROS = False
|
||||
VERSION = "Basic Erasure (BE)"
|
||||
VERSION = Basic Erasure (BE)
|
||||
|
||||
{% elif baseline_erease %}
|
||||
DH_HOST = {{ api_host }}
|
||||
|
@ -28,11 +28,11 @@ WB_SMART_TEST = short
|
|||
WB_ERASE = EraseSectors
|
||||
WB_ERASE_STEPS = {{ erase_steps }}
|
||||
WB_ERASE_LEADING_ZEROS = True
|
||||
VERSION = {%if erase_steps < 3 %}"Baseline Secure Erasure (BSE)"{% else %}"Enhanced Secure Erasure (ESE)"{% endif %}
|
||||
VERSION = {%if erase_steps < 3 %}Baseline Secure Erasure (BSE){% else %}Enhanced Secure Erasure (ESE){% endif %}
|
||||
|
||||
{% else %}
|
||||
SNAPSHOTS_PATH = /mnt
|
||||
LOGS_PATH = /mnt
|
||||
VERSION = "Basic Metadata (BM)"
|
||||
VERSION = Basic Metadata (BM)
|
||||
|
||||
{% endif %}
|
|
@ -6,6 +6,7 @@
|
|||
"software": "Workbench",
|
||||
"version": "2022.03.00",
|
||||
"schema_api": "1.0.0",
|
||||
"settings_version": "Basic Metadata",
|
||||
"data": {
|
||||
"lspci": "",
|
||||
"lshw": {
|
||||
|
|
|
@ -1413,3 +1413,18 @@ def test_bug_4028_components(user: UserClient):
|
|||
|
||||
for c in m.Device.query.filter():
|
||||
assert c.binding or c.placeholder
|
||||
|
||||
|
||||
@pytest.mark.mvp
|
||||
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||
def test_settings_version(user: UserClient):
|
||||
"""Tests when we have one computer and then we change the disk, then
|
||||
the new disk need to have placeholder too."""
|
||||
s = file_json("2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json")
|
||||
body, res = user.post(s, uri="/api/inventory/")
|
||||
assert m.Computer.query.first().dhid == body['dhid']
|
||||
snapshot = Snapshot.query.first()
|
||||
log = SnapshotsLog.query.first()
|
||||
|
||||
assert log.get_version() == "14.0 (BM)"
|
||||
assert snapshot.settings_version == "Basic Metadata"
|
||||
|
|
Reference in a new issue