checking if 2 users find the same computer but registered 2 times

This commit is contained in:
Cayo Puigdefabregas 2020-11-06 21:01:29 +01:00
parent bc5cbb2eff
commit 2055af222d
1 changed files with 21 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import pytest import pytest
import uuid
from teal.utils import compiled from teal.utils import compiled
from ereuse_devicehub.client import UserClient from ereuse_devicehub.client import UserClient
@ -185,6 +186,26 @@ def test_device_query(user: UserClient):
assert not pc['tags'] assert not pc['tags']
@pytest.mark.mvp
def test_device_query_permitions(user: UserClient, user2: UserClient):
"""Checks result of inventory for two users"""
user.post(file('basic.snapshot'), res=Snapshot)
i, _ = user.get(res=Device)
pc1 = next(d for d in i['items'] if d['type'] == 'Desktop')
i2, _ = user2.get(res=Device)
assert i2['items'] == []
basic_snapshot = file('basic.snapshot')
basic_snapshot['uuid'] = f"{uuid.uuid4()}"
user2.post(basic_snapshot, res=Snapshot)
i2, _ = user2.get(res=Device)
pc2 = next(d for d in i2['items'] if d['type'] == 'Desktop')
assert pc1['id'] != pc2['id']
assert pc1['hid'] == pc2['hid']
@pytest.mark.mvp @pytest.mark.mvp
def test_device_search_all_devices_token_if_empty(app: Devicehub, user: UserClient): def test_device_search_all_devices_token_if_empty(app: Devicehub, user: UserClient):
"""Ensures DeviceSearch can regenerate itself when the table is empty.""" """Ensures DeviceSearch can regenerate itself when the table is empty."""