예제 #1
0
    def test_version(self):
        version = Version()
        version.name = "a"
        version.description = "b"
        version.uri = "c"
        version.major = 2
        version.minor = 3
        version.status = Version.Status.draft

        version_dto = VersionDto(version)

        self.assertEqual("a", version_dto.name)
        self.assertEqual("b", version_dto.description)
        self.assertEqual("c", version_dto.uri)
        self.assertEqual(2, version_dto.major)
        self.assertEqual(3, version_dto.minor)
예제 #2
0
    def test_version(self):
        version = Version()
        version.name = "a"
        version.description = "b"
        version.uri = "c"
        version.major = 2
        version.minor = 3
        version.status = Version.Status.draft

        version_dto = VersionDto(version)

        self.assertEqual("a", version_dto.name)
        self.assertEqual("b", version_dto.description)
        self.assertEqual("c", version_dto.uri)
        self.assertEqual(2, version_dto.major)
        self.assertEqual(3, version_dto.minor)
예제 #3
0
    def create_from_name_and_dictionary(self, name, datas):
        """Return a populated object Version from dictionary datas
        """
        version = ObjectVersion()
        self.set_common_datas(version, name, datas)

        if "uri" in datas:
            version.uri = str(datas["uri"])
        if "major" in datas:
            version.major = int(datas["major"])
        if "minor" in datas:
            version.minor = int(datas["minor"])
        if "status" in datas:
            version.status = self.get_enum("status", ObjectVersion.Status, datas)

        version.methods = self.method_factory.create_dictionary_of_element_from_dictionary("methods", datas)
        version.types = self.type_factory.create_dictionary_of_element_from_dictionary("types", datas)
        version.references = self.reference_factory.create_dictionary_of_element_from_dictionary("references", datas)

        return version
예제 #4
0
파일: version.py 프로젝트: lampard1010/mock
    def create_from_name_and_dictionary(self, name, datas):
        """Return a populated object Version from dictionary datas
        """
        version = ObjectVersion()
        self.set_common_datas(version, name, datas)

        if "uri" in datas:
            version.uri = str(datas["uri"])
        if "major" in datas:
            version.major = int(datas["major"])
        if "minor" in datas:
            version.minor = int(datas["minor"])
        if "status" in datas:
            version.status = self.get_enum("status", ObjectVersion.Status,
                                           datas)

        version.methods = self.method_factory.create_dictionary_of_element_from_dictionary(
            "methods", datas)
        version.types = self.type_factory.create_dictionary_of_element_from_dictionary(
            "types", datas)
        version.references = self.reference_factory.create_dictionary_of_element_from_dictionary(
            "references", datas)

        return version