def test_check_user_key_return(self):
     '''
     Test check_user_key method - return
     '''
     mock_hana_inst = MagicMock()
     mock_hana = MagicMock(return_value=mock_hana_inst)
     with patch.object(hanamod, '_init', mock_hana):
         hanamod.check_user_key('key', 'prd', '00', 'pass')
         mock_hana.assert_called_once_with('prd', '00', 'pass')
         mock_hana_inst.check_user_key.assert_called_once_with('key')
 def test_check_user_key_raise(self):
     '''
     Test check_user_key method - raise
     '''
     mock_hana_inst = MagicMock()
     mock_hana_inst.check_user_key.side_effect = hanamod.hana.HanaError(
         'hana error')
     mock_hana = MagicMock(return_value=mock_hana_inst)
     with patch.object(hanamod, '_init', mock_hana):
         with pytest.raises(exceptions.CommandExecutionError) as err:
             hanamod.check_user_key('key', 'prd', '00', 'pass')
         mock_hana.assert_called_once_with('prd', '00', 'pass')
         mock_hana_inst.check_user_key.assert_called_once_with('key')
         assert 'hana error' in str(err)