def test_as_json_with_children_with_name(self): step = Step(app='HelloWorld', action='helloWorld', name='name') self.basic_json['name'] = 'name' self.assertDictEqual(step.as_json(with_children=True), self.basic_json)
def test_as_json_without_children_with_device(self): step = Step(app='HelloWorld', action='helloWorld', device='device') self.basic_json['device'] = 'device' self.assertDictEqual(step.as_json(with_children=False), self.basic_json)
def test_init_with_widgets(self): widgets = [('aaa', 'bbb'), ('ccc', 'ddd'), ('eee', 'fff')] step = Step(app='HelloWorld', action='helloWorld', widgets=widgets) self.__compare_init(step, '', '', 'helloWorld', 'HelloWorld', '', {}, [], [], ['', ''], widgets)
def test_init_with_device(self): step = Step(app='HelloWorld', action='helloWorld', device='dev') self.__compare_init(step, '', '', 'helloWorld', 'HelloWorld', 'dev', {}, [], [], ['', ''], [])
def test_init_with_name(self): step = Step(app='HelloWorld', action='helloWorld', name='name') self.__compare_init(step, 'name', '', 'helloWorld', 'HelloWorld', '', {}, [], [], ['', 'name'], [])
def test_init_with_invalid_input_type(self): with self.assertRaises(InvalidInput): Step(app='HelloWorld', action='returnPlusOne', inputs={'number': 'invalid'})
def test_init_with_inputs_with_conversion(self): step = Step(app='HelloWorld', action='returnPlusOne', inputs={'number': '-5.6'}) self.__compare_init(step, '', '', 'returnPlusOne', 'HelloWorld', '', {'number': -5.6}, [], [], ['', ''], [])