def it_configures_and_runs_a_process(self):
     self.a_node = Node()
     self.another_node = Node()
     self.a_decorator = FakeDecorator()
     #process was restarted by setUp()
     the_movement = self.process.configure_activity_logger(
         self.a_node, self.another_node, self.process.create_loan_request,
         FakeDecorator.do_something)
     #starts running
     the_movement.context = self.process.run_activity(
         the_movement, self.a_decorator, 10)
     the_movement.context['result'] | should | equal_to(
         "this is an operation's return value:10")
     self.process.current_state() | should | equal_to('request_created')
     #configures and runs the template's refusal path
     #should go wrong
     the_movement = self.process.configure_activity_logger(
         self.a_node, self.another_node, self.process.loan_refused,
         FakeDecorator.do_something)
     (self.process.run_activity, the_movement, self.a_decorator,
      10) | should | throw(InvalidTransition)
     #now doing the right thing
     the_movement = self.process.configure_activity_logger(
         self.a_node, self.another_node,
         self.process.analyst_select_request, FakeDecorator.do_something)
     the_movement.context = self.process.run_activity(
         the_movement, self.a_decorator, 10)
     self.process.current_state() | should | equal_to('request_analyzed')
     the_movement = self.process.configure_activity_logger(
         self.a_node, self.another_node, self.process.loan_refused,
         FakeDecorator.do_something)
     the_movement.context = self.process.run_activity(
         the_movement, self.a_decorator, 15)
     self.process.current_state() | should | equal_to('refusal_letter_sent')
Esempio n. 2
0
 def setUp(self):
     self.a_client = Node()
     self.the_company = Node()
     self.a_process = Process(self.the_company, self.a_client)
     self.a_processing_unit = Node()
     self.a_movement = Movement(self.a_processing_unit,
                                self.a_processing_unit)
 def it_typifies_itself(self):
     another_node = Node()
     self.movement.set_source(self.a_node)
     #a transportation from a_node to Null
     self.movement.is_transportation() | should | be(True)
     self.movement.set_destination(self.a_node)
     #a transformation inside a_node
     self.movement.is_transformation() | should | be(True)
     self.movement.set_destination(another_node)
     #a transportation from a_node to another_node
     self.movement.is_transportation() | should | be(True)
Esempio n. 4
0
 def it_moves_a_resource_between_two_nodes(self):
     another_node = Node()
     self.a_node.output_area['resource'] = self.a_resource
     self.a_node.output_area['non_resource'] = "I am not a Resource"
     #should not work
     (Node.move_resource, 'wrong key', self.a_node,
      another_node) | should | throw(KeyError)
     (Node.move_resource, 'non_resource', self.a_node,
      another_node) | should | throw(ContractError)
     #should work
     Node.move_resource('resource', self.a_node, another_node)
     another_node.input_area | should | include('resource')
 def setUp(self):
     self.a_node = Node()
     self.movement = Movement()
Esempio n. 6
0
 def setUp(self):
     self.a_client = Node()
     self.the_company = Node()
     self.a_process = Process()
     self.a_process.set_source(self.the_company)
     self.a_process.set_destination(self.a_client)
Esempio n. 7
0
 def setUp(self):
     self.a_node = Node()
     self.a_resource = Resource()