Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_Mandates_Get_For_User(self):
user = self.getJohn()
bankAccountId = self.getJohnsAccount().Id
returnUrl = 'http://test.test'
mandatePost = Mandate()
mandatePost.BankAccountId = bankAccountId
mandatePost.Culture = 'EN'
mandatePost.ReturnURL = returnUrl
mandateCreated = self.sdk.mandates.Create(mandatePost)
sorting = Sorting()
sorting.AddField("CreationDate", SortDirection.DESC)
mandates = self.sdk.mandates.GetForUser(user.Id, Pagination(), sorting)
self.assertIsNotNone(mandates)
self.assertIsNotNone(mandates[0])
self.assertTrue(mandateCreated.Id == mandates[0].Id)
def test_Users_BankAccounts_SortByCreationDate(self):
john = self.getJohn()
self.getJohnsAccount()
self._johnsAccount = None
time.sleep(2)
self.getJohnsAccount()
pagination = Pagination(1, 10)
sorting = Sorting()
sorting.AddField('CreationDate', SortDirection.DESC)
list = self.sdk.users.GetBankAccounts(john.Id, pagination, sorting)
self.assertTrue(list[0].CreationDate > list[1].CreationDate)
def test_Users_Cards_SortByCreationDate(self):
john = self.getJohn()
self.getJohnsPayInCardDirect()
time.sleep(2)
self.getJohnsPayInCardDirect()
pagination = Pagination(1, 10)
sorting = Sorting()
sorting.AddField('CreationDate', SortDirection.DESC)
list = self.sdk.users.GetCards(john.Id, pagination, sorting)
self.assertTrue(list[0].CreationDate > list[1].CreationDate)
def test_Wallets_Transactions_SortByCreationDate(self):
wallet = self.getJohnsWallet()
#create 2 pay-in objects
self.getJohnsPayInCardWeb()
time.sleep(2)
self.getJohnsPayInCardWeb()
sorting = Sorting()
sorting.AddField('CreationDate', SortDirection.DESC)
pagination = Pagination(1, 20)
filter = FilterTransactions()
filter.Type = TransactionType.PAYIN
transactions = self.sdk.wallets.GetTransactions(wallet.Id, pagination, filter, sorting)
self.assertTrue(transactions[0].CreationDate > transactions[1].CreationDate)
def test_Mandates_Get_For_Bank_Account(self):
user = self.getJohn()
bankAccountId = self.getJohnsAccount().Id
returnUrl = 'http://test.test'
mandatePost = Mandate()
mandatePost.BankAccountId = bankAccountId
mandatePost.Culture = 'EN'
mandatePost.ReturnURL = returnUrl
mandateCreated = self.sdk.mandates.Create(mandatePost)
sorting = Sorting()
sorting.AddField("CreationDate", SortDirection.DESC)
mandates = self.sdk.mandates.GetForBankAccount(user.Id, bankAccountId, Pagination(), sorting)
self.assertIsNotNone(mandates)
self.assertIsNotNone(mandates[0])
self.assertTrue(mandateCreated.Id == mandates[0].Id)
def refreshClientDisputes(self):
sorting = Sorting()
sorting.AddField("CreationDate", SortDirection.DESC)
pagination = Pagination(1, 100)
self._clientDisputes = self.sdk.disputes.GetAll(pagination, None, sorting)
self.assertIsNotNone(self._clientDisputes, 'INITIALIZATION FAILURE - cannot test disputes')
self.assertTrue(len(self._clientDisputes) > 0, 'INITIALIZATION FAILURE - cannot test disputes')
return
def test_Events_GetEvents(self):
sorting = Sorting()
sorting.AddField("Date", "desc")
events = self.sdk.events.Get(None, None, sorting)
self.assertTrue(events[0].Date > events[len(events) - 1].Date)
sorting = Sorting()
sorting.AddField("Date", "asc")
events = self.sdk.events.Get(None, None, sorting)
self.assertTrue(events[0].Date < events[len(events) - 1].Date)
self.assertNotEqual(events[0].ResourceId, None)
self.assertNotEqual(events[0].ResourceId, '')
self.assertNotEqual(events[0].EventType, None)
self.assertNotEqual(events[0].EventType, '')
self.assertNotEqual(events[0].Date, None)
self.assertNotEqual(events[0].Date, '')
def test_Users_GetAll(self):
sorting = Sorting()
sorting.AddField("CreationDate", SortDirection.DESC)
users = self.sdk.users.GetAll(None, sorting)
self.assertTrue(users[0].CreationDate > users[len(users) - 1].CreationDate)
sorting = Sorting()
sorting.AddField("CreationDate", SortDirection.ASC)
users = self.sdk.users.GetAll(None, sorting)
self.assertTrue(users[0].CreationDate < users[len(users) - 1].CreationDate)
def test_KycDocuments_GetAll_SortByCreationDate(self):
pagination = Pagination(1, 10)
sorting = Sorting()
sorting.AddField('CreationDate', SortDirection.DESC)
list = self.sdk.kycdocuments.GetAll(pagination, sorting)
self.assertTrue(list[0].CreationDate >= list[1].CreationDate)