class TransportationSpec(unittest.TestCase):

    def setUp(self):
        self.a_resource = Resource()
        self.a_person = Person()
        self.a_machine = Machine()
        self.a_transportation = Transportation(self.a_person, self.a_machine)

    def it_transports(self):
        #should throw KeyError
        (self.a_transportation.transport,'resource key') |should| throw(KeyError)
        #should work
        self.a_person.output_area['resource key'] = self.a_resource
        self.a_transportation.transport('resource key')
        self.a_machine.input_area |should| contain('resource key')
class TransportationSpec(unittest.TestCase):
    def setUp(self):
        self.a_resource = Resource()
        self.a_person = Person()
        self.a_machine = Machine()
        self.a_transportation = Transportation(self.a_person, self.a_machine)

    def it_transports(self):
        #should throw KeyError
        (self.a_transportation.transport,
         'resource key') | should | throw(KeyError)
        #should work
        self.a_person.output_area['resource key'] = self.a_resource
        self.a_transportation.transport('resource key')
        self.a_machine.input_area | should | contain('resource key')
def then_a_loan_of_value_value_for_account_account_number_is_generated(
        step, value, account_number):
    #moves the loan to the processing area of the account
    world.move_loan_to_account = Transportation(world.credit_analyst.decorated,
                                                world.account.decorated)
    #picks the loan by its type - no way to know here its key
    for item in world.credit_analyst.decorated.output_area.values():
        if item.__class__.__name__ == 'Loan':
            break
    world.move_loan_to_account.transport(item.datetime)
    world.account.decorated.input_area | should | contain(item.datetime)
def and_the_loan_request_is_moved_to_the_account_account_number_historic(
        step, account_number):
    #creates the movement
    world.move_loan_request_to_account = Transportation(
        world.credit_analyst.decorated, world.account.decorated)
    #insert the movement into the business process
    world.an_individual_credit_operation.insert_movement(
        'move loan request to account', world.move_loan_request_to_account)
    #perform! (world.account.number is the loan request key)
    world.an_individual_credit_operation.movements[
        'move loan request to account'].transport(world.account.number)
    #moves from the input area to the log area
    world.account.decorated.transfer(world.account.number, 'input', 'log')
    world.account.decorated.log_area | should | have(1).loan_request
 def setUp(self):
     self.a_resource = Resource()
     self.a_person = Person()
     self.a_machine = Machine()
     self.a_transportation = Transportation(self.a_person, self.a_machine)
 def setUp(self):
     self.a_resource = Resource()
     self.a_person = Person()
     self.a_machine = Machine()
     self.a_transportation = Transportation(self.a_person, self.a_machine)