]> git.proxmox.com Git - ceph.git/blob - ceph/src/python-common/ceph/tests/test_inventory.py
69c1c306cf8015a6ad595a35a9495ae27d814aef
[ceph.git] / ceph / src / python-common / ceph / tests / test_inventory.py
1 import json
2 import os
3 import pytest
4
5 from ceph.deployment.inventory import Devices
6
7
8 @pytest.mark.parametrize("filename",
9 [
10 os.path.dirname(__file__) + '/c-v-inventory.json',
11 os.path.dirname(__file__) + '/../../../pybind/mgr/test_orchestrator/du'
12 'mmy_data.json',
13 ])
14 def test_from_json(filename):
15 with open(filename) as f:
16 data = json.load(f)
17 if 'inventory' in data:
18 data = data['inventory']
19 ds = Devices.from_json(data)
20 assert len(ds.devices) == len(data)
21 assert Devices.from_json(ds.to_json()) == ds