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