From daeae1b4b4b3005e5247d98a1f690222da472fd7 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 26 Nov 2020 19:08:07 +0100 Subject: [PATCH] fixed deallocate code bug --- ereuse_devicehub/resources/action/models.py | 4 +++- tests/test_action.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 936298d7..dfd8e348 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -321,7 +321,9 @@ class Allocate(JoinedTableMixin, ActionWithMultipleDevices): class Deallocate(JoinedTableMixin, ActionWithMultipleDevices): """The act of deallocate one list of devices to one person of the system or not """ - pass + code = Column(CIText(), default='', nullable=True) + code.comment = """ This is a internal code for mainteing the secrets of the personal datas of the new holder """ + end_users = Column(Numeric(precision=4), check_range('end_users', 0), nullable=True) class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): diff --git a/tests/test_action.py b/tests/test_action.py index d9231923..17bc1b39 100644 --- a/tests/test_action.py +++ b/tests/test_action.py @@ -253,7 +253,7 @@ def test_live(user: UserClient, app: Devicehub): snapshot, _ = user.post(acer, res=models.Snapshot) device_id = snapshot['device']['id'] db_device = Device.query.filter_by(id=1).one() - post_request = {"Transaction": "ccc", "name": "John", "end_users": 1, + post_request = {"transaction": "ccc", "name": "John", "end_users": 1, "devices": [device_id], "description": "aaa", "start_time": "2020-11-01T02:00:00+00:00", "end_time": "2020-12-01T02:00:00+00:00"