<s> from collections import namedtuple <EOL> from moto . swf . exceptions import SWFUnknownResourceFault <EOL> from moto . swf . models import Domain <EOL> import tests . backport_assert_raises <EOL> WorkflowExecution = namedtuple ( <EOL> "<STR_LIT>" , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> ) <EOL> def test_domain_short_dict_representation ( ) : <EOL> domain = Domain ( "<STR_LIT:foo>" , "<STR_LIT>" ) <EOL> domain . to_short_dict ( ) . should . equal ( { "<STR_LIT:name>" : "<STR_LIT:foo>" , "<STR_LIT:status>" : "<STR_LIT>" } ) <EOL> domain . description = "<STR_LIT>" <EOL> domain . to_short_dict ( ) [ "<STR_LIT:description>" ] . should . equal ( "<STR_LIT>" ) <EOL> def test_domain_full_dict_representation ( ) : <EOL> domain = Domain ( "<STR_LIT:foo>" , "<STR_LIT>" ) <EOL> domain . to_full_dict ( ) [ "<STR_LIT>" ] . should . equal ( domain . to_short_dict ( ) ) <EOL> _config = domain . to_full_dict ( ) [ "<STR_LIT>" ] <EOL> _config [ "<STR_LIT>" ] . should . equal ( "<STR_LIT>" ) <EOL> def test_domain_string_representation ( ) : <EOL> domain = Domain ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> str ( domain ) . should . equal ( "<STR_LIT>" ) <EOL> def test_domain_add_to_activity_task_list ( ) : <EOL> domain = Domain ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> domain . add_to_activity_task_list ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) <EOL> domain . activity_task_lists . should . equal ( { <EOL> "<STR_LIT:foo>" : [ "<STR_LIT:bar>" ] <EOL> } ) <EOL> def test_domain_activity_tasks ( ) : <EOL> domain = Domain ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> domain . add_to_activity_task_list ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) <EOL> domain . add_to_activity_task_list ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> sorted ( domain . activity_tasks ) . should . equal ( [ "<STR_LIT:bar>" , "<STR_LIT>" ] ) <EOL> def test_domain_add_to_decision_task_list ( ) : <EOL> domain = Domain ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> domain . add_to_decision_task_list ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) <EOL> domain . decision_task_lists . should . equal ( { <EOL> "<STR_LIT:foo>" : [ "<STR_LIT:bar>" ] <EOL> } ) <EOL> def test_domain_decision_tasks ( ) : <EOL> domain = Domain ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> domain . add_to_decision_task_list ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) <EOL> domain . add_to_decision_task_list ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> sorted ( domain . decision_tasks ) . should . equal ( [ "<STR_LIT:bar>" , "<STR_LIT>" ] ) <EOL> def test_domain_get_workflow_execution ( ) : <EOL> domain = Domain ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> wfe1 = WorkflowExecution ( workflow_id = "<STR_LIT>" , run_id = "<STR_LIT>" , execution_status = "<STR_LIT>" , open = True ) <EOL> wfe2 = WorkflowExecution ( workflow_id = "<STR_LIT>" , run_id = "<STR_LIT>" , execution_status = "<STR_LIT>" , open = False ) <EOL> wfe3 = WorkflowExecution ( workflow_id = "<STR_LIT>" , run_id = "<STR_LIT>" , execution_status = "<STR_LIT>" , open = True ) <EOL> wfe4 = WorkflowExecution ( workflow_id = "<STR_LIT>" , run_id = "<STR_LIT>" , execution_status = "<STR_LIT>" , open = False ) <EOL> domain . workflow_executions = [ wfe1 , wfe2 , wfe3 , wfe4 ] <EOL> domain . get_workflow_execution ( "<STR_LIT>" , run_id = "<STR_LIT>" ) . should . equal ( wfe1 ) <EOL> domain . get_workflow_execution ( "<STR_LIT>" , run_id = "<STR_LIT>" ) . should . equal ( wfe2 ) <EOL> domain . get_workflow_execution ( "<STR_LIT>" , run_id = "<STR_LIT>" ) . should . equal ( wfe4 ) <EOL> domain . get_workflow_execution . when . called_with ( <EOL> "<STR_LIT>" , run_id = "<STR_LIT>" <EOL> ) . should . throw ( <EOL> SWFUnknownResourceFault , <EOL> ) <EOL> domain . get_workflow_execution ( "<STR_LIT>" ) . should . equal ( wfe1 ) <EOL> domain . get_workflow_execution . when . called_with ( <EOL> "<STR_LIT>" <EOL> ) . should . throw ( <EOL> SWFUnknownResourceFault <EOL> ) <EOL> domain . get_workflow_execution . when . called_with ( <EOL> "<STR_LIT>" <EOL> ) . should . throw ( <EOL> SWFUnknownResourceFault <EOL> ) <EOL> domain . get_workflow_execution ( "<STR_LIT>" , run_id = "<STR_LIT>" , raise_if_closed = True ) . should . equal ( wfe1 ) <EOL> domain . get_workflow_execution . when . called_with ( <EOL> "<STR_LIT>" , run_id = "<STR_LIT>" , raise_if_closed = True <EOL> ) . should . throw ( <EOL> SWFUnknownResourceFault <EOL> ) <EOL> domain . get_workflow_execution ( "<STR_LIT:foo>" , raise_if_none = False ) . should . be . none </s>
