specific test for unassign

This commit is contained in:
Cayo Puigdefabregas 2021-08-17 11:22:50 +02:00
parent 3e232e40c7
commit fdea06f08f
1 changed files with 27 additions and 0 deletions

View File

@ -512,6 +512,33 @@ def test_get_devices_unassigned(app: Devicehub, user: UserClient):
assert res.status_code == 200 assert res.status_code == 200
assert len(devices['items']) == 1 assert len(devices['items']) == 1
url = '/devices/?filter={"type":["Computer"]}&unassign=1'
devices, res = user.get(url, None)
assert res.status_code == 200
assert len(devices['items']) == 1
from ereuse_devicehub.resources.lot.models import Lot
device_id = devices['items'][0]['id']
my_lot, _ = user.post(({'name': 'My_lot'}), res=Lot)
lot, _ = user.post({},
res=Lot,
item='{}/devices'.format(my_lot['id']),
query=[('id', device_id)])
assert lot['devices'][0]['id'] == device_id, 'Lot contains device'
url = '/devices/?filter={"type":["Computer"]}&unassign=0'
devices, res = user.get(url, None)
assert res.status_code == 200
assert len(devices['items']) == 1
url = '/devices/?filter={"type":["Computer"]}&unassign=1'
devices, res = user.get(url, None)
assert res.status_code == 200
assert len(devices['items']) == 0
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.auth_app_context.__name__) @pytest.mark.usefixtures(conftest.auth_app_context.__name__)