Skip to content

Commit e8ffde4

Browse files
author
krgupta
committed
tests overriding setenvironment(customendpoint) method. Allowing developers to select environment
1 parent 098991d commit e8ffde4

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

authorizenet/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class constants(object):
1313

1414
'''Environments'''
1515
SANDBOX_TESTMODE = 'https://apitest.authorize.net/xml/v1/request.api'
16-
PRODUCTION = 'https://api.authorize.net/xml/v1/request.api'
16+
PRODUCTION = 'https://api2.authorize.net/xml/v1/request.api'
1717

1818
'''xml encoding'''
1919
xml_encoding = 'utf-8'

tests/testssample.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@author: krgupta
55
'''
66
from authorizenet import apicontractsv1
7+
from authorizenet import constants
78
from decimal import *
89
from authorizenet.apicontractsv1 import CTD_ANON
910
#from controller.CreateTransactionController import CreateTransactionController
@@ -20,16 +21,16 @@
2021
from authorizenet.apicontrollers import *
2122
import test
2223
from authorizenet import utility
24+
from authorizenet.apicontrollersbase import APIOperationBase
2325

2426
class test_ReadProperty(apitestbase.ApiTestBase):
2527
def testPropertyFromFile(self):
2628
login= utility.helper.getproperty("api_login_id")
2729
transactionkey = utility.helper.getproperty("transaction_key")
2830
self.assertIsNotNone(login)
2931
self.assertIsNotNone(transactionkey)
30-
32+
3133
class test_TransactionReportingUnitTest(apitestbase.ApiTestBase):
32-
3334
def testGetTransactionDetails(self):
3435

3536
gettransactiondetailsrequest = apicontractsv1.getTransactionDetailsRequest()
@@ -38,8 +39,8 @@ def testGetTransactionDetails(self):
3839
gettransactiondetailscontroller = getTransactionDetailsController(gettransactiondetailsrequest)
3940
gettransactiondetailscontroller.execute()
4041
response = gettransactiondetailscontroller.getresponse()
41-
self.assertEquals('Ok', response.messages.resultCode)
42-
42+
self.assertEquals('Ok', response.messages.resultCode)
43+
4344
class test_RecurringBillingTest(apitestbase.ApiTestBase):
4445

4546
def testCreateSubscription(self):
@@ -120,6 +121,41 @@ def testauthOnlyContinueTransaction(self):
120121
response = createtransactioncontroller.getresponse()
121122
self.assertIsNotNone(response.transactionResponse)
122123
self.assertIsNotNone(response.transactionResponse.transId)
123-
124+
125+
'''
126+
class test_ProductionURL(apitestbase.ApiTestBase):
127+
'' '' ''Tests will run only with production credentials
128+
'' '' ''
129+
130+
def testGetSettledBatchList(self):
131+
settledBatchListRequest = apicontractsv1.getSettledBatchListRequest()
132+
settledBatchListRequest.merchantAuthentication = self.merchantAuthentication
133+
settledBatchListController = getSettledBatchListController(settledBatchListRequest)
134+
customEndpoint = constants.PRODUCTION
135+
apicontrollersbase.APIOperationBase.setenvironment(customEndpoint)
136+
settledBatchListController.execute()
137+
response = settledBatchListController.getresponse()
138+
self.assertEquals('Ok', response.messages.resultCode)
139+
140+
def testGetListofSubscriptions(self):
141+
sorting = apicontractsv1.ARBGetSubscriptionListSorting()
142+
sorting.orderBy = apicontractsv1.ARBGetSubscriptionListOrderFieldEnum.id
143+
sorting.orderDescending = "false"
144+
paging = apicontractsv1.Paging()
145+
paging.limit = 1000
146+
paging.offset = 1
147+
GetListofSubscriptionRequest = apicontractsv1.ARBGetSubscriptionListRequest()
148+
GetListofSubscriptionRequest.merchantAuthentication = self.merchantAuthentication
149+
GetListofSubscriptionRequest.refId = "Sample"
150+
GetListofSubscriptionRequest.searchType = apicontractsv1.ARBGetSubscriptionListSearchTypeEnum.subscriptionInactive
151+
GetListofSubscriptionRequest.sorting = sorting
152+
GetListofSubscriptionRequest.paging = paging
153+
arbgetsubscriptionlistcontroller = ARBGetSubscriptionListController(GetListofSubscriptionRequest)
154+
customEndpoint = constants.PRODUCTION
155+
apicontrollersbase.APIOperationBase.setenvironment(customEndpoint)
156+
arbgetsubscriptionlistcontroller.execute()
157+
response = arbgetsubscriptionlistcontroller.getresponse()
158+
self.assertEquals('Ok', response.messages.resultCode)
159+
'''
124160
if __name__ =='__main__':
125161
unittest.main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy