示例#1
0
 def test_sr_enable_primary_return(self):
     '''
     Test sr_enable_primary method - return
     '''
     mock_hana_inst = MagicMock()
     mock_hana = MagicMock(return_value=mock_hana_inst)
     with patch.object(hanamod, '_init', mock_hana):
         hanamod.sr_enable_primary('NUE', 'prd', '00', 'pass')
         mock_hana.assert_called_once_with('prd', '00', 'pass')
         mock_hana_inst.sr_enable_primary.assert_called_once_with('NUE')
示例#2
0
 def test_sr_enable_primary_raise(self):
     '''
     Test sr_enable_primary method - raise
     '''
     mock_hana_inst = MagicMock()
     mock_hana_inst.sr_enable_primary.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.sr_enable_primary('NUE', 'prd', '00', 'pass')
         mock_hana.assert_called_once_with('prd', '00', 'pass')
         mock_hana_inst.sr_enable_primary.assert_called_once_with('NUE')
         assert 'hana error' in str(err)