From 45b44ce17ba97c7792669b98a54ecdf956481c87 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 25 Mar 2021 11:26:30 +0100 Subject: [PATCH] fixing tests --- ereuse_devicehub/resources/action/__init__.py | 5 +++++ tests/test_action.py | 16 +--------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/ereuse_devicehub/resources/action/__init__.py b/ereuse_devicehub/resources/action/__init__.py index 7fd91eb8..a584f038 100644 --- a/ereuse_devicehub/resources/action/__init__.py +++ b/ereuse_devicehub/resources/action/__init__.py @@ -250,6 +250,11 @@ class MakeAvailable(ActionDef): SCHEMA = schemas.MakeAvailable +class TradeDef(ActionDef): + VIEW = None + SCHEMA = schemas.Trade + + class CancelTradeDef(ActionDef): VIEW = None SCHEMA = schemas.CancelTrade diff --git a/tests/test_action.py b/tests/test_action.py index 40962e49..2f0a1ea4 100644 --- a/tests/test_action.py +++ b/tests/test_action.py @@ -747,7 +747,7 @@ def test_deallocate_bad_dates(user: UserClient): (models.Rent, states.Trading.Renting), (models.DisposeProduct, states.Trading.ProductDisposed) ])) -def test_trade2(action_model_state: Tuple[Type[models.Action], states.Trading], user: UserClient): +def test_trade(action_model_state: Tuple[Type[models.Action], states.Trading], user: UserClient): """Tests POSTing all Trade actions.""" # todo missing None states.Trading for after cancelling renting, for example # import pdb; pdb.set_trace() @@ -769,20 +769,6 @@ def test_trade2(action_model_state: Tuple[Type[models.Action], states.Trading], assert device['trading'] == state.name -@pytest.mark.mvp -def test_trade(user: UserClient, user2: UserClient): - """Tests POST one simple Trade action with both users as system users.""" - # import pdb; pdb.set_trace() - snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot) - action = { - 'type': 'Trade', - 'devices': [snapshot['device']['id']], - 'user_to': user2.user['email'] - } - action, _ = user.post(action, res=models.Action) - assert action['devices'][0]['id'] == snapshot['device']['id'] - - @pytest.mark.mvp @pytest.mark.usefixtures(conftest.auth_app_context.__name__) def test_price_custom():