From f8ec8fc882485558743abd3053e1e858cb2ae84d Mon Sep 17 00:00:00 2001 From: Xavier Bustamante Talavera Date: Sat, 6 Jul 2019 15:06:22 +0200 Subject: [PATCH] Change ReadyToUse for Available --- ereuse_devicehub/dummy/dummy.py | 4 ++-- ereuse_devicehub/resources/action/__init__.py | 4 ++-- ereuse_devicehub/resources/action/models.py | 2 +- ereuse_devicehub/resources/action/schemas.py | 4 ++-- ereuse_devicehub/resources/device/states.py | 2 +- tests/test_event.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ereuse_devicehub/dummy/dummy.py b/ereuse_devicehub/dummy/dummy.py index 2d6f3e80..829bfa6f 100644 --- a/ereuse_devicehub/dummy/dummy.py +++ b/ereuse_devicehub/dummy/dummy.py @@ -104,7 +104,7 @@ class Dummy: # Perform generic actions for pc, model in zip(pcs, - {m.ToRepair, m.Repair, m.ToPrepare, m.ReadyToUse, m.ToPrepare, + {m.ToRepair, m.Repair, m.ToPrepare, m.Available, m.ToPrepare, m.Prepare}): user.post({'type': model.t, 'devices': [pc]}, res=m.Action) @@ -144,7 +144,7 @@ class Dummy: user.post({'type': m.ToPrepare.t, 'devices': [sample_pc]}, res=m.Action) user.post({'type': m.Prepare.t, 'devices': [sample_pc]}, res=m.Action) - user.post({'type': m.ReadyToUse.t, 'devices': [sample_pc]}, res=m.Action) + user.post({'type': m.Available.t, 'devices': [sample_pc]}, res=m.Action) user.post({'type': m.Price.t, 'device': sample_pc, 'currency': 'EUR', 'price': 85}, res=m.Action) # todo test reserve diff --git a/ereuse_devicehub/resources/action/__init__.py b/ereuse_devicehub/resources/action/__init__.py index 9ee1ba18..6b9588c9 100644 --- a/ereuse_devicehub/resources/action/__init__.py +++ b/ereuse_devicehub/resources/action/__init__.py @@ -188,9 +188,9 @@ class RepairDef(ActionDef): SCHEMA = schemas.Repair -class ReadyToUse(ActionDef): +class Available(ActionDef): VIEW = None - SCHEMA = schemas.ReadyToUse + SCHEMA = schemas.Available class ToPrepareDef(ActionDef): diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 81576b6e..0ea6817f 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -1256,7 +1256,7 @@ class Repair(ActionWithMultipleDevices): """ -class ReadyToUse(ActionWithMultipleDevices): +class Available(ActionWithMultipleDevices): """The device is ready to be used. This involves greater preparation from the ``Prepare`` action, diff --git a/ereuse_devicehub/resources/action/schemas.py b/ereuse_devicehub/resources/action/schemas.py index 00210deb..5daee52a 100644 --- a/ereuse_devicehub/resources/action/schemas.py +++ b/ereuse_devicehub/resources/action/schemas.py @@ -347,8 +347,8 @@ class Repair(ActionWithMultipleDevices): __doc__ = m.Repair.__doc__ -class ReadyToUse(ActionWithMultipleDevices): - __doc__ = m.ReadyToUse.__doc__ +class Available(ActionWithMultipleDevices): + __doc__ = m.Available.__doc__ class ToPrepare(ActionWithMultipleDevices): diff --git a/ereuse_devicehub/resources/device/states.py b/ereuse_devicehub/resources/device/states.py index bc69c664..daaff20a 100644 --- a/ereuse_devicehub/resources/device/states.py +++ b/ereuse_devicehub/resources/device/states.py @@ -56,5 +56,5 @@ class Physical(State): Repaired = e.Repair Preparing = e.ToPrepare Prepared = e.Prepare - ReadyToBeUsed = e.ReadyToUse + ReadyToBeUsed = e.Available InUse = e.Live diff --git a/tests/test_event.py b/tests/test_event.py index d035dfe0..791d5e68 100644 --- a/tests/test_event.py +++ b/tests/test_event.py @@ -168,7 +168,7 @@ def test_update_components_action_multiple(): hdd = HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar') computer.components.add(hdd) - ready = models.ReadyToUse() + ready = models.Available() assert not ready.devices assert not ready.components @@ -214,7 +214,7 @@ def test_update_parent(): (models.ToRepair, states.Physical.ToBeRepaired), (models.Repair, states.Physical.Repaired), (models.ToPrepare, states.Physical.Preparing), - (models.ReadyToUse, states.Physical.ReadyToBeUsed), + (models.Available, states.Physical.ReadyToBeUsed), (models.Prepare, states.Physical.Prepared) ])) def test_generic_action(action_model_state: Tuple[models.Action, states.Trading],