adding tests for recycling and reuse

This commit is contained in:
Cayo Puigdefabregas 2021-09-22 14:33:46 +02:00
parent b195e380a9
commit e861ae3bf8

View file

@ -255,6 +255,24 @@ def test_generic_action(action_model_state: Tuple[models.Action, states.Trading]
assert snapshot['device']['updated'] != device['updated'] assert snapshot['device']['updated'] != device['updated']
@pytest.mark.mvp
def test_recycling(user: UserClient):
snap, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
action = {'type': models.Recycling.t, 'devices': [snap['device']['id']]}
action, _ = user.post(action, res=models.Action)
device, _ = user.get(res=Device, item=snap['device']['devicehubID'])
assert device['actions'][-1]['id'] == action['id']
@pytest.mark.mvp
def test_reuse(user: UserClient):
snap, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
action = {'type': models.Reuse.t, 'devices': [snap['device']['id']]}
action, _ = user.post(action, res=models.Action)
device, _ = user.get(res=Device, item=snap['device']['devicehubID'])
assert device['actions'][-1]['id'] == action['id']
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_live(user: UserClient, client: Client, app: Devicehub): def test_live(user: UserClient, client: Client, app: Devicehub):