def test_calculate_percent_vg(self):
        '''Convert a percent of total blockdev space to explicit byte count.'''
        vg_size = 20 * 1000 * 1000  # 20 mb drive
        lv_size = math.floor(.2 * vg_size)  # calculate 20% of drive size
        size_str = '20%'

        vg = VolumeGroup(None, size=vg_size, available_size=vg_size)

        calc_size = ApplyNodeStorage.calculate_bytes(size_str=size_str,
                                                     context=vg)

        assert calc_size == lv_size
    def test_calculate_percent_blockdev(self):
        '''Convert a percent of total blockdev space to explicit byte count.'''
        drive_size = 20 * 1000 * 1000  # 20 mb drive
        part_size = math.floor(.2 * drive_size)  # calculate 20% of drive size
        size_str = '20%'

        drive = BlockDevice(None, size=drive_size, available_size=drive_size)

        calc_size = ApplyNodeStorage.calculate_bytes(size_str=size_str,
                                                     context=drive)

        assert calc_size == part_size