test settings version
This commit is contained in:
parent
534adbba75
commit
9736ee323a
|
@ -1413,3 +1413,36 @@ def test_bug_4028_components(user: UserClient):
|
||||||
|
|
||||||
for c in m.Device.query.filter():
|
for c in m.Device.query.filter():
|
||||||
assert c.binding or c.placeholder
|
assert c.binding or c.placeholder
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_settings_version(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')
|
||||||
|
s['settings_version']= 'Basic Metadata (BM)'
|
||||||
|
snap1, _ = user.post(s, res=Snapshot)
|
||||||
|
dev1 = m.Device.query.filter_by(id=snap1['device']['id']).one()
|
||||||
|
assert m.Placeholder.query.count() * 2 == m.Device.query.count()
|
||||||
|
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]
|
||||||
|
|
||||||
|
assert '' not in [c.phid() for c in components1]
|
||||||
|
assert '' not in [c.phid() for c in components2]
|
||||||
|
assert len(components1) == len(components2)
|
||||||
|
assert m.Placeholder.query.count() == 16
|
||||||
|
assert m.Placeholder.query.count() * 2 == m.Device.query.count()
|
||||||
|
for c in m.Placeholder.query.filter():
|
||||||
|
assert c.binding
|
||||||
|
assert c.device
|
||||||
|
|
||||||
|
for c in m.Device.query.filter():
|
||||||
|
assert c.binding or c.placeholder
|
||||||
|
|
Reference in New Issue