new tests
This commit is contained in:
parent
3b41ddb66a
commit
818e3ad0cc
|
@ -1774,6 +1774,8 @@ class MoveOnDocument(JoinedTableMixin, ActionWithMultipleTradeDocuments):
|
||||||
|
|
||||||
|
|
||||||
class Delete(ActionWithMultipleDevices):
|
class Delete(ActionWithMultipleDevices):
|
||||||
|
# TODO in a new architecture we need rename this class to Deactivate
|
||||||
|
|
||||||
"""The act save in device who and why this devices was delete.
|
"""The act save in device who and why this devices was delete.
|
||||||
We never delete one device, but we can deactivate."""
|
We never delete one device, but we can deactivate."""
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -2827,7 +2827,7 @@ def test_delete_devices(user: UserClient):
|
||||||
|
|
||||||
snap, _ = user.post(file('acer.happy.battery.snapshot'), res=models.Snapshot)
|
snap, _ = user.post(file('acer.happy.battery.snapshot'), res=models.Snapshot)
|
||||||
request = {'type': 'Delete', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'duplicity of devices', 'endTime': '2021-07-07T22:00:00.000Z'}
|
request = {'type': 'Delete', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'duplicity of devices', 'endTime': '2021-07-07T22:00:00.000Z'}
|
||||||
|
|
||||||
action, _ = user.post(res=models.Action, data=request)
|
action, _ = user.post(res=models.Action, data=request)
|
||||||
|
|
||||||
# Check get one device
|
# Check get one device
|
||||||
|
@ -2841,6 +2841,7 @@ def test_delete_devices(user: UserClient):
|
||||||
assert db_device.active == False
|
assert db_device.active == False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check use of filter from frontend
|
# Check use of filter from frontend
|
||||||
url = '/devices/?filter={"type":["Computer"]}'
|
url = '/devices/?filter={"type":["Computer"]}'
|
||||||
|
|
||||||
|
@ -2848,6 +2849,32 @@ def test_delete_devices(user: UserClient):
|
||||||
assert len(devices['items']) == 0
|
assert len(devices['items']) == 0
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_delete_devices_check_sync(user: UserClient):
|
||||||
|
"""This action deactive one device and simulate than one devices is delete."""
|
||||||
|
|
||||||
|
file_snap1 = file('1-device-with-components.snapshot')
|
||||||
|
file_snap2 = file('2-device-with-components.snapshot')
|
||||||
|
snap, _ = user.post(file_snap, res=models.Snapshot)
|
||||||
|
request = {'type': 'Delete', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'duplicity of devices', 'endTime': '2021-07-07T22:00:00.000Z'}
|
||||||
|
|
||||||
|
action, _ = user.post(res=models.Action, data=request)
|
||||||
|
|
||||||
|
device1 = Device.query.filter_by(id=snap['device']['id']).one()
|
||||||
|
|
||||||
|
snap2, _ = user.post(file_snap, res=models.Snapshot)
|
||||||
|
request2 = {'type': 'Delete', 'devices': [snap2['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'duplicity of devices', 'endTime': '2021-07-07T22:00:00.000Z'}
|
||||||
|
|
||||||
|
action2, _ = user.post(res=models.Action, data=request2)
|
||||||
|
|
||||||
|
device2 = Device.query.filter_by(id=snap2['device']['id']).one()
|
||||||
|
# TODO problems with alembic and migrations
|
||||||
|
# TODO check than device2 is an other device than device1
|
||||||
|
# TODO check than device2 have the components of device1
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
def test_moveOnDocument_bug168(user: UserClient, user2: UserClient):
|
def test_moveOnDocument_bug168(user: UserClient, user2: UserClient):
|
||||||
|
|
Reference in New Issue