svn commit: r1858267 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: groovyScripts/test/AutoAcctgPaymentTests.groovy testdef/data/AccountingTestsData.xml

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

svn commit: r1858267 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: groovyScripts/test/AutoAcctgPaymentTests.groovy testdef/data/AccountingTestsData.xml

surajk
Author: surajk
Date: Sat Apr 27 12:02:22 2019
New Revision: 1858267

URL: http://svn.apache.org/viewvc?rev=1858267&view=rev
Log:
Improved: Unit test case for service - setPaymentStatus.
(OFBIZ-9084)
Thanks Deepak Nigam for reporting and Anushi Gupta for providing the updated patch.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy
    ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml

Modified: 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=1858267&r1=1858266&r2=1858267&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy Sat Apr 27 12:02:22 2019
@@ -39,4 +39,17 @@ class AutoAcctgPaymentTests extends Groo
         assert payment.paymentTypeId == 'CUSTOMER_PAYMENT'
         assert payment.paymentMethodTypeId == 'COMPANY_CHECK'
     }
+
+    void testSetPaymentStatus() {
+        Map serviceCtx = [:]
+        serviceCtx.paymentId = '1000'
+        serviceCtx.statusId = 'PAYMENT_AUTHORIZED'
+        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        Map serviceResult = dispatcher.runSync('setPaymentStatus', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue payment = EntityQuery.use(delegator).from('Payment').where('paymentId', '1000').queryOne()
+        assert payment
+        assert serviceResult.oldStatusId == 'PAYMENT_NOT_AUTH'
+    }
 }

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml?rev=1858267&r1=1858266&r2=1858267&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml Sat Apr 27 12:02:22 2019
@@ -100,4 +100,6 @@ under the License.
     <!-- For Testing service createInvoiceContent-->
     <Invoice invoiceId="1008" invoiceTypeId="PURCHASE_INVOICE" statusId="INVOICE_IN_PROCESS" partyIdFrom="DEMO_COMPANY" partyId="DEMO_COMPANY1" invoiceDate="2016-11-03 00:00:00"/>
     <Content contentId="1000" contentTypeId="DOCUMENT"/>
+    <!-- For Testing service setPaymentStatus -->
+    <Payment paymentId="1000" paymentTypeId="CUSTOMER_PAYMENT" paymentMethodTypeId="COMPANY_CHECK"  partyIdFrom="DEMO_COMPANY" partyIdTo="DEMO_COMPANY1" amount="100.00" statusId="PAYMENT_NOT_AUTH" />
 </entity-engine-xml>