def test_parameter(self): parameter = Parameter() parameter.name = "a" parameter.type = "string" parameter.optional = True parameter.position = 0 parameter_sample = ParameterSample(parameter) self.assertEqual("a", parameter_sample.name) self.assertTrue(parameter_sample.optional) self.assertEqual("my_a", parameter_sample.sample) self.assertFalse(parameter_sample.is_query_string)
def test_parameter(self): parameter = Parameter() parameter.name = "a" parameter.type = "string" parameter.optional = True parameter.position = 0 parameter_sample = ParameterSample(parameter) self.assertEqual("a", parameter_sample.name) self.assertTrue(parameter_sample.optional) self.assertEqual("my_a", parameter_sample.sample) self.assertFalse(parameter_sample.is_query_string)
def create_from_name_and_dictionary(self, name, datas): """Return a populated object Parameter from dictionary datas """ parameter = ObjectParameter() self.set_common_datas(parameter, name, datas) if "optional" in datas: parameter.optional = to_bool(datas["optional"]) if "type" in datas: parameter.type = str(datas["type"]) if "generic" in datas: parameter.generic = to_bool(datas["generic"]) return parameter
def create_from_name_and_dictionary(self, name, datas): """Return a populated object Parameter from dictionary datas """ parameter = ObjectParameter() self.set_common_datas(parameter, name, datas) if "optional" in datas: parameter.optional = to_boolean(datas["optional"]) if "type" in datas: parameter.type = str(datas["type"]) if "generic" in datas: parameter.generic = to_boolean(datas["generic"]) return parameter
def test_parameter_compare__with_name(self): parameter = Parameter() parameter.name = "a" parameter.type = "string" parameter.optional = True parameter.position = 0 parameter_sample1 = ParameterSample(parameter) parameter_sample2 = ParameterSample(parameter) parameter_sample1.name = "a" parameter_sample2.name = "b" self.assertTrue(parameter_sample1 < parameter_sample2)
def test_parameter_compare__with_name(self): parameter = Parameter() parameter.name = "a" parameter.type = "string" parameter.optional = True parameter.position = 0 parameter_sample1 = ParameterSample(parameter) parameter_sample2 = ParameterSample(parameter) parameter_sample1.name = "a" parameter_sample2.name = "b" self.assertTrue(parameter_sample1 < parameter_sample2)
def test_positionable_parameter(self): parameter = Parameter() parameter.name = "a" parameter.description = "b" parameter.type = "foo" parameter.optional = False parameter_dto = RequestParameterDto(parameter) self.assertEqual("a", parameter_dto.name) self.assertEqual("b", parameter_dto.description) self.assertEqual(False, parameter_dto.optional) self.assertEqual(False, parameter_dto.is_internal) self.assertEqual(0, parameter_dto.position) self.assertEqual(False, parameter_dto.is_query_string)
def test_positionable_parameter(self): parameter = Parameter() parameter.name = "a" parameter.description = "b" parameter.type = "foo" parameter.optional = False parameter_dto = RequestParameterDto(parameter) self.assertEqual("a", parameter_dto.name) self.assertEqual("b", parameter_dto.description) self.assertEqual(False, parameter_dto.optional) self.assertEqual(False, parameter_dto.is_internal) self.assertEqual(0, parameter_dto.position) self.assertEqual(False, parameter_dto.is_query_string)