def test_install_return(self, mock_hana): ''' Test install method - return ''' mock_hana.install.return_value = 'hana.conf' hanamod.install('software_path', 'hana.conf', 'root', 'root') mock_hana.install.assert_called_once_with('software_path', 'hana.conf', 'root', 'root')
def test_install_raise(self, mock_hana): ''' Test install method - raise ''' mock_hana.install.side_effect = hanamod.hana.HanaError('hana error') with pytest.raises(exceptions.CommandExecutionError) as err: hanamod.install('software_path', 'hana.conf', 'root', 'root') mock_hana.install.assert_called_once_with('software_path', 'hana.conf', 'root', 'root') assert 'hana error' in str(err)