Best Python code snippet using localstack_python
test_swf.py
Source:test_swf.py
...13 self.swf_client.register_domain(14 name=self.workflow_domain_name, workflowExecutionRetentionPeriodInDays="1"15 )16 def test_run_workflow(self):17 self.given_workflow()18 self.when_workflow_is_started()19 self.then_workflow_components_execute()20 self.then_workflow_history_has_expected_events()21 def given_workflow(self):22 self.swf_client.register_workflow_type(23 domain=self.workflow_domain_name,24 name=self.workflow_type_name,25 version=self.swf_version,26 defaultExecutionStartToCloseTimeout="500",27 defaultTaskStartToCloseTimeout="300",28 defaultTaskList=DEFAULT_TASK_LIST,29 defaultChildPolicy="TERMINATE",30 )31 workflow_types = self.swf_client.list_workflow_types(32 domain=self.workflow_domain_name, registrationStatus="REGISTERED"33 )34 self.assertIn(35 self.workflow_type_name,...
test_execution_result_processor.py
Source:test_execution_result_processor.py
...16 outcome.next_step = 117 step = WorkflowStep(StepBody)18 step.outcomes = [outcome]19 self._pointer_factory.build_next_pointer.return_value = pointer220 workflow = given_workflow([pointer1])21 wf_result = WorkflowExecutorResult()22 self._subject.process_execution_result(workflow, definition, pointer1, step, ExecutionResult.next(), wf_result)23 self.assertFalse(pointer1.active)24 self.assertEqual(pointer1.status, ExecutionPointer.COMPLETE)25 self.assertIsNotNone(pointer1.end_time)26 self.assertIn(pointer2, workflow.execution_pointers)27 self._pointer_factory.build_next_pointer.assert_called()28 def test_set_persistence_data(self):29 persistence_data = "abc"30 definition = WorkflowDefinition()31 pointer1 = build_pointer(0, True, ExecutionPointer.RUNNING)32 step = WorkflowStep(StepBody)33 workflow = given_workflow([pointer1])34 wf_result = WorkflowExecutorResult()35 self._subject.process_execution_result(workflow, definition, pointer1, step, ExecutionResult.persist(persistence_data), wf_result)36 self.assertEqual(pointer1.persistence_data, persistence_data)37 self.assertIsNone(pointer1.end_time)38 def test_subscribe_to_event(self):39 definition = WorkflowDefinition()40 pointer1 = build_pointer(0, True, ExecutionPointer.RUNNING)41 step = WorkflowStep(StepBody)42 workflow = given_workflow([pointer1])43 wf_result = WorkflowExecutorResult()44 self._subject.process_execution_result(workflow, definition, pointer1, step, ExecutionResult.wait_for_event("Event", "Key", datetime.utcnow()), wf_result)45 self.assertTrue(any(x for x in wf_result.subscriptions if x.step_id == pointer1.step_id and x.event_name == "Event" and x.event_key == "Key"))46 self.assertEqual(pointer1.status, ExecutionPointer.WAITING)47 self.assertEqual(pointer1.event_name, "Event")48 self.assertEqual(pointer1.event_key, "Key")49 self.assertFalse(pointer1.active)50 self.assertIsNone(pointer1.end_time)51def build_pointer(id, active, status):52 result = ExecutionPointer()53 result.id = id54 result.active = active55 result.status = status56 return result57def given_workflow(pointers):58 result = WorkflowInstance()59 result.status = WorkflowInstance.RUNNABLE60 result.execution_pointers.extend(pointers)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!