Ejemplo n.º 1
0
 def test_ReturnTransfer(self):
     svr = service_transfer()
     current_account = account()
     saving_account = account()
     current_account.balance = 500
     ret = svr.doTransfer(100, current_account, saving_account)
     self.assertEqual("Done", svr.ret)
Ejemplo n.º 2
0
    def test_DebitCurrentAccount(self):
        # Arrange
        svr = service_transfer()
        current_account = account()
        saving_account = account()
        current_account.balance = 500

        # Act
        ret = svr.doTransfer(100, current_account, saving_account)

        # Assert
        self.assertEqual(400, current_account.balance)
Ejemplo n.º 3
0
    def test_DoNotTransferIfAmountExceeded(self):
         # Arrange
        max_transfer = 2000
        svr = service_transfer(max_transfer)
        current_account = account()
        saving_account = account()
        current_account.balance = 100

        # Act
        ret = svr.doTransfer(200, current_account, saving_account)
 
        # Assert
        self.assertEqual("Error_Amount_Exceeded", svr.ret)
Ejemplo n.º 4
0
    def test_DoNotTransferIfAmountCappedExceeded(self):
         # Arrange
        max_transfer = 2000
        svr = service_transfer(max_transfer)
        current_account = account()
        saving_account = account()
        current_account.balance = 1000
        saving_account.balance = 0
       
        # Act
        ret = svr.doTransfer(2001, current_account, saving_account)
 
        # Assert
        self.assertEqual("Refused_Exceed_Capped_Amount", svr.ret)
Ejemplo n.º 5
0
    def test_CreditSavingAccount(self):
        
        # Arrange
        max_transfer = 2000
        svr = service_transfer(max_transfer)
        current_account = account()
        saving_account = account()
        current_account.balance = 500

        # Act
        ret = svr.doTransfer(100, current_account, saving_account)
        
        # Assert
        self.assertEqual(100, saving_account.balance)
Ejemplo n.º 6
0
def get_list():
    customer_list = []
    file = open(FILENAME, 'r')
    for line in file.readlines():
        data = line.split()
        customer = account(data[0], data[1], data[2], data[3], data[4],
                           data[5])
        customer_list.append(customer)

    file.close()
    return customer_list
Ejemplo n.º 7
0
from behave import *
from nose.tools import *
from Model.account import account
from Model.service_transfer import service_transfer

max_tranfer = 2000
svr = service_transfer(max_tranfer)
current_account = account()
saving_account = account()


@given(u'I have a current account with a balance of {amount:d} euros')
def step_impl(context, amount):
    current_account.balance = amount


@given(u'I have a saving account with a balance of {amount:d} euros')
def step_impl(context, amount):
    saving_account.balance = amount


@given(u'the tranfer from account is limited to {amount:d} euros')
def step_impl(context, amount):
    current_account.maxAmountTransfer = amount


@when(
    u'I transfer {amount:d} euros from the current account to my savings account'
)
def step_impl(context, amount):
    ret = svr.doTransfer(amount, current_account, saving_account)