[ Avaa Bypassed ]




Upload:

Command:

www-data@3.144.165.218: ~ $
import testtools
import json

from probert.storage import Storage, StorageInfo
from probert.tests.fakes import FAKE_PROBE_ALL_JSON


class ProbertTestStorage(testtools.TestCase):
    def setUp(self):
        super(ProbertTestStorage, self).setUp()
        with open(FAKE_PROBE_ALL_JSON) as f:
            self.results = json.load(f)
        self.storage = Storage(results=self.results)

    def test_storage_init(self):
        self.assertNotEqual(None, self.storage)


class ProbertTestStorageInfo(testtools.TestCase):
    ''' properties:
        .name = /dev/sda
        .type = disk
        .vendor = SanDisk
        .model = SanDisk_12123123
        .serial = aaccasdf
        .devpath = /devices
        .is_virtual =
        .raw = {raw dictionary}
    '''
    def setUp(self):
        super(ProbertTestStorageInfo, self).setUp()
        with open(FAKE_PROBE_ALL_JSON) as f:
            self.results = json.load(f)

    def test_storageinfo_init(self):
        probe_data = {
            '/dev/sda': {
                'DEVTYPE': 'disk',
                'attrs': {
                    'size': '1000000'
                }
            }
        }
        si = StorageInfo(probe_data)
        self.assertNotEqual(si, None)

    def test_storageinfo_attributes(self):
        sda = {'/dev/sda': self.results.get('storage').get('/dev/sda')}
        si = StorageInfo(probe_data=sda)
        props = {
            'name': '/dev/sda',
            'type': 'disk',
            'vendor': 'SanDisk',
            'model': 'SanDisk_SD5SG2128G1052E',
            'serial': 'SanDisk_SD5SG2128G1052E_133507400177',
            'devpath': (
                '/devices/pci0000:00/0000:00:1f.2/ata1/'
                'host0/target0:0:0/0:0:0:0/block/sda'
            ),
            'is_virtual': False,
            'raw': sda.get('/dev/sda')
        }
        for (prop, value) in props.items():
            self.assertEqual(getattr(si, prop), value)

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
data Folder 0755
__init__.py File 0 B 0644
fakes.py File 201 B 0644
helpers.py File 1.48 KB 0644
test_dasd.py File 9.49 KB 0644
test_lvm.py File 12.18 KB 0644
test_multipath.py File 4.53 KB 0644
test_prober.py File 1.37 KB 0644
test_storage.py File 1.89 KB 0644
test_utils.py File 2.21 KB 0644