# Path: hardware/bios_hp.py
# def get_hp_conrep(hrdw):
# def dump_hp_bios(hrdw):
# 
# Path: hardware/tests/utils.py
# def sample(name, mode='r'):
#     return open(os.path.join(_BASEDIR, 'samples', name), mode).read()


import unittest
from unittest import mock
from hardware import bios_hp
from hardware.tests.utils import sample
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestBiosHP(unittest.TestCase):

    @mock.patch('hardware.bios_hp.get_hp_conrep',
                return_value=(True, sample('conrep.dat')))
    def test_bios_hp(self, mocked_cmd):
        self.maxDiff = None
        hw_list = []
        hardware_lst = bios_hp.dump_hp_bios(hw_list)
        self.assertEqual(
            hardware_lst,
            [(u'hp', u'bios', u'Language', u'English'),
             (u'hp', u'bios', u'Setup_Browser_Selection', u'Auto'),
             (u'hp', u'bios', u'Workload_Profile', u'Custom'),
             (u'hp', u'bios', u'Dynamic_Power_Capping_Functionality',
              u'Disabled'),
             (u'hp', u'bios', u'Extended_Memory_Test', u'Disabled'),
             (u'hp', u'bios', u'Memory_Fast_Training', u'Enabled'),
             (u'hp', u'bios', u'UEFI_POST_Discovery_Mode', u'Auto'),

# Path: hardware/bios_hp.py
# def get_hp_conrep(hrdw):
# def dump_hp_bios(hrdw):
# 
# Path: hardware/tests/utils.py
# def sample(name, mode='r'):
#     return open(os.path.join(_BASEDIR, 'samples', name), mode).read()


# Path: hardware/tests/test_bios_hp.py
import unittest
from unittest import mock
from hardware import bios_hp
from hardware.tests.utils import sample

#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestBiosHP(unittest.TestCase):

    @mock.patch('hardware.bios_hp.get_hp_conrep',
                return_value=(True, sample('conrep.dat')))
    def test_bios_hp(self, mocked_cmd):
        self.maxDiff = None
        hw_list = []
        hardware_lst = bios_hp.dump_hp_bios(hw_list)
        self.assertEqual(
            hardware_lst,
            [(u'hp', u'bios', u'Language', u'English'),
             (u'hp', u'bios', u'Setup_Browser_Selection', u'Auto'),
             (u'hp', u'bios', u'Workload_Profile', u'Custom'),
             (u'hp', u'bios', u'Dynamic_Power_Capping_Functionality',
              u'Disabled'),
             (u'hp', u'bios', u'Extended_Memory_Test', u'Disabled'),
             (u'hp', u'bios', u'Memory_Fast_Training', u'Enabled'),
             (u'hp', u'bios', u'UEFI_POST_Discovery_Mode', u'Auto'),

             (u'hp', u'bios', u'Memory_Clear_on_Warm_Reset', u'Disabled'),