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