From 545a1013e92ed70e68d627696dbd0fb17ac9dc82 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 8 Apr 2022 11:10:03 +0200 Subject: [PATCH] add schema_version --- ereuse_devicehub/config.py | 58 ++++++++++--------- ...QMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json | 3 +- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index 4a1f03c7..2d9118f5 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -1,39 +1,49 @@ from distutils.version import StrictVersion from itertools import chain from typing import Set -from decouple import config +from decouple import config from teal.auth import TokenAuth from teal.config import Config from teal.enums import Currency from teal.utils import import_resource -from ereuse_devicehub.resources import action, agent, deliverynote, inventory, \ - lot, tag, user +from ereuse_devicehub.resources import ( + action, + agent, + deliverynote, + inventory, + lot, + tag, + user, +) from ereuse_devicehub.resources.device import definitions from ereuse_devicehub.resources.documents import documents -from ereuse_devicehub.resources.tradedocument import definitions as tradedocument from ereuse_devicehub.resources.enums import PriceSoftware -from ereuse_devicehub.resources.versions import versions from ereuse_devicehub.resources.licences import licences from ereuse_devicehub.resources.metric import definitions as metric_def +from ereuse_devicehub.resources.tradedocument import definitions as tradedocument +from ereuse_devicehub.resources.versions import versions class DevicehubConfig(Config): - RESOURCE_DEFINITIONS = set(chain(import_resource(definitions), - import_resource(action), - import_resource(user), - import_resource(tag), - import_resource(agent), - import_resource(lot), - import_resource(deliverynote), - import_resource(documents), - import_resource(tradedocument), - import_resource(inventory), - import_resource(versions), - import_resource(licences), - import_resource(metric_def), - ),) + RESOURCE_DEFINITIONS = set( + chain( + import_resource(definitions), + import_resource(action), + import_resource(user), + import_resource(tag), + import_resource(agent), + import_resource(lot), + import_resource(deliverynote), + import_resource(documents), + import_resource(tradedocument), + import_resource(inventory), + import_resource(versions), + import_resource(licences), + import_resource(metric_def), + ), + ) PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str] SECRET_KEY = config('SECRET_KEY') DB_USER = config('DB_USER', 'dhub') @@ -48,12 +58,12 @@ class DevicehubConfig(Config): db=DB_DATABASE, ) # type: str SCHEMA = config('SCHEMA', 'dbtest') - HOST = config('HOST', 'localhost') + HOST = config('HOST', 'localhost') MIN_WORKBENCH = StrictVersion('11.0a1') # type: StrictVersion """The minimum version of ereuse.org workbench that this devicehub accepts. we recommend not changing this value. """ - WORKBENCH_LITE = ["2022.03.00"] + WORKBENCH_LITE = ["V1"] TMP_SNAPSHOTS = config('TMP_SNAPSHOTS', '/tmp/snapshots') TMP_LIVES = config('TMP_LIVES', '/tmp/lives') @@ -61,11 +71,7 @@ class DevicehubConfig(Config): """This var is for save a snapshots in json format when fail something""" API_DOC_CONFIG_TITLE = 'Devicehub' API_DOC_CONFIG_VERSION = '0.2' - API_DOC_CONFIG_COMPONENTS = { - 'securitySchemes': { - 'bearerAuth': TokenAuth.API_DOCS - } - } + API_DOC_CONFIG_COMPONENTS = {'securitySchemes': {'bearerAuth': TokenAuth.API_DOCS}} API_DOC_CLASS_DISCRIMINATOR = 'type' PRICE_SOFTWARE = PriceSoftware.Ereuse diff --git a/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json b/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json index 5cc3f352..3093c7e5 100644 --- a/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json +++ b/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json @@ -1,10 +1,11 @@ { "timestamp": "2022-03-31T19:09:57.167164", "type": "Snapshot", - "uuid": "cdecaf47-6e32-4ccb-b689-95c064d8c513", + "uuid": "cdecaf47-6e32-4ccb-b689-95c064d8c514", "wbid": "MLKO1Y0R55XZM051WQ5KJM01RY44Q", "software": "Workbench", "version": "2022.03.00", + "schema_version": "V1", "data": { "lshw": { "id": "__",