def then_a_new_loan_request_with_the_account_number_and_desired_value_is_created(
        step, account_number, desired_value):
    #Processes are nodes that use the company as the source node, and the client as destination
    world.the_company = Machine()
    world.a_client = Person()
    #now the business process starts to be assembled
    world.an_individual_credit_operation = Process(world.the_company,
                                                   world.a_client)
    world.loan_request_creation = Transformation(
        world.credit_analyst.decorated, world.credit_analyst.decorated)
    world.loan_request_creation.set_action(
        world.credit_analyst.create_loan_request)
    world.loan_request_creation.action | should | equal_to(
        world.credit_analyst.create_loan_request)
    #associates the transformation to the process
    world.an_individual_credit_operation.insert_movement(
        'loan request creation', world.loan_request_creation)
    world.an_individual_credit_operation.movements | should | contain(
        'loan request creation')
    #finally it runs the transformation...
    world.an_individual_credit_operation.movements[
        'loan request creation'].perform(world.account, desired_value)
    #checks if the loan request is stored in the Node's input_area
    world.credit_analyst.decorated.input_area | should | contain(
        account_number)
def when_i_pick_to_analyse_the_loan_request_of_account_account_number(
        step, account_number):
    #creates a new transformation to register the analysis
    world.loan_request_analysis = Transformation(
        world.credit_analyst.decorated, world.credit_analyst.decorated)
    #associates analyse operation to the transformation
    world.loan_request_analysis.set_action(world.credit_analyst.analyse)
    #associates the transformation to the process
    world.an_individual_credit_operation.insert_movement(
        'loan request analysis', world.loan_request_analysis)
    #finally it runs the transformation...
    #must refactor process.movements to make it easier to find operations => use a dictionary
    world.an_individual_credit_operation.movements[
        'loan request analysis'].perform(world.account.number)
    #if everything is ok the loan request was stored in the Node's output_area
    world.credit_analyst.decorated.output_area | should | contain(
        account_number)
def when_i_pick_and_perfom_this_loan(step):
    #picking...
    loan_request = world.credit_analyst.decorated.output_area[
        world.account.number]
    #preparing to perform...
    world.create_loan = Transformation(world.credit_analyst.decorated,
                                       world.credit_analyst.decorated)
    world.create_loan.set_action(world.credit_analyst.create_loan)
    world.an_individual_credit_operation.insert_movement(
        'loan creation', world.create_loan)
    #performing!
    world.an_individual_credit_operation.movements['loan creation'].perform(
        loan_request)
    #given that I am using datetime to generate the key, I cannot access the newly
    #created loan through its key
    #output_area must have at least the loan_request and the newly created loan
    world.credit_analyst.decorated.output_area.values() | should | have(
        2).itens
Exemplo n.º 4
0
class TransformationSpec(unittest.TestCase):
    def setUp(self):
        self.a_person = Person()
        self.a_transformation = Transformation(self.a_person, self.a_person)

    @operation(category='business')
    def an_operation(self, argument):
        ''' operations must be documented'''
        return argument

    def non_operation(self):
        return 0

    def it_sets_its_action(self):
        #should not work
        self.a_transformation.set_action(
            self.non_operation) | should | be(False)
        #should work
        self.a_transformation.set_action(self.an_operation)
        self.a_transformation.action | should | equal_to(self.an_operation)

    def it_performs(self):
        self.a_transformation.set_action(self.an_operation)
        self.a_transformation.perform(10)
Exemplo n.º 5
0
class TransformationSpec(unittest.TestCase):

    def setUp(self):
        self.a_person = Person()
        self.a_transformation = Transformation(self.a_person, self.a_person)

    @operation(category='business')
    def an_operation(self, argument):
        ''' operations must be documented'''
        return argument

    def non_operation(self):
        return 0

    def it_sets_its_action(self):
        #should not work
        self.a_transformation.set_action(self.non_operation) |should| be(False)
        #should work
        self.a_transformation.set_action(self.an_operation)
        self.a_transformation.action |should| equal_to(self.an_operation)

    def it_performs(self):
        self.a_transformation.set_action(self.an_operation)
        self.a_transformation.perform(10)
Exemplo n.º 6
0
 def setUp(self):
     self.a_person = Person()
     self.a_transformation = Transformation(self.a_person, self.a_person)
Exemplo n.º 7
0
 def setUp(self):
     self.a_person = Person()
     self.a_transformation = Transformation(self.a_person, self.a_person)