This commit is contained in:
Cayo Puigdefabregas 2022-11-03 17:49:01 +01:00
parent 0aa4696fe0
commit 74d10e1951

View file

@ -1380,3 +1380,27 @@ def test_system_uuid_motherboard(user: UserClient):
snap2, _ = user.post(s, res=Snapshot, status=422) snap2, _ = user.post(s, res=Snapshot, status=422)
txt = "We have detected that a there is a device in your inventory" txt = "We have detected that a there is a device in your inventory"
assert txt in snap2['message'][0] assert txt in snap2['message'][0]
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_bug_4028_components(user: UserClient):
"""Tests when we have one computer and then we change the disk, then
the new disk need to have placeholder too."""
s = yaml2json('real-eee-1001pxd.snapshot.12')
snap1, _ = user.post(s, res=Snapshot)
dev1 = m.Device.query.filter_by(id=snap1['device']['id']).one()
components1 = [c for c in dev1.components]
for c in s['components']:
if c['type'] == 'HardDrive':
c['serialNumber'] = 'E2024242CV86MF'
s['uuid'] = str(uuid4())
snap2, _ = user.post(s, res=Snapshot)
dev2 = m.Device.query.filter_by(id=snap2['device']['id']).one()
components2 = [c for c in dev2.components]
# import pdb; pdb.set_trace()
assert '' not in [c.phid() for c in components1]
assert '' not in [c.phid() for c in components2]