svn commit: r1851148 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: groovyScripts/test/AutoAcctgPaymentTests.groovy testdef/accountingtests.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1851148 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: groovyScripts/test/AutoAcctgPaymentTests.groovy testdef/accountingtests.xml

surajk
Author: surajk
Date: Sat Jan 12 08:14:18 2019
New Revision: 1851148

URL: http://svn.apache.org/viewvc?rev=1851148&view=rev
Log:
Added:Unit test case for service - createPayment.
(OFBIZ-9083)
Thanks Deepak Nigam for reporting and Yogesh Naroliya for providing the updated patch.

Added:
    ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy   (with props)
Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml

Added: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy?rev=1851148&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy (added)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy Sat Jan 12 08:14:18 2019
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityQuery
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.testtools.GroovyScriptTestCase
+
+class AutoAcctgPaymentTests extends GroovyScriptTestCase {
+    void testCreatePayment() {
+        Map serviceCtx = [:]
+        serviceCtx.paymentTypeId = 'CUSTOMER_PAYMENT'
+        serviceCtx.partyIdFrom = 'Company'
+        serviceCtx.partyIdTo = 'DemoCustCompany'
+        serviceCtx.amount = new BigDecimal('100.00')
+        serviceCtx.paymentMethodTypeId = 'COMPANY_CHECK'
+        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        Map serviceResult = dispatcher.runSync('createPayment', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue payment = EntityQuery.use(delegator).from('Payment').where('paymentId', serviceResult.paymentId).queryOne()
+        assert payment.paymentTypeId == 'CUSTOMER_PAYMENT'
+        assert payment.paymentMethodTypeId == 'COMPANY_CHECK'
+    }
+}

Propchange: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml?rev=1851148&r1=1851147&r2=1851148&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml Sat Jan 12 08:14:18 2019
@@ -57,4 +57,7 @@
     <test-case case-name="auto-accounting-invoice-tests">
         <simple-method-test location="component://accounting/minilang/test/AutoAcctgInvoiceTests.xml"/>
     </test-case>
+    <test-case case-name="auto-accounting-payment-tests">
+        <groovy-test-suite location="component://accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy"/>
+    </test-case>
 </test-suite>