Пример #1
0
    def test_version_compare__with_major(self):
        version1 = VersionDto(Version())
        version2 = VersionDto(Version())
        version1.major = 1
        version2.major = 2

        self.assertEqual(version1, sorted([version2, version1])[0])
Пример #2
0
    def test_define_changes_status__updated(self):
        root_dto = RootDto()

        version1 = Version()
        version1.name = "v1"
        version1.major = 1
        version1 = VersionDto(version1)
        version2 = Version()
        version2.name = "v2"
        version2.major = 2
        version2 = VersionDto(version2)

        category1 = MethodCategory(Category("c1"))

        method1 = Method()
        method1.changes_status = {
            "v1": MultiVersion.Changes.new,
            "v2": MultiVersion.Changes.updated
        }

        category1.methods = [method1]

        root_dto.versions = [version1, version2]
        root_dto.method_categories = [category1]

        self.factory.define_changes_status(root_dto)

        self.assertEqual(MultiVersion.Changes.new,
                         method1.changes_status["v1"])
        self.assertEqual(MultiVersion.Changes.updated,
                         method1.changes_status["v2"])
Пример #3
0
    def test_version_compare__with_label(self):
        version1 = VersionDto(Version())
        version2 = VersionDto(Version())
        version1.major = 1
        version1.minor = 1
        version1.label = "a"
        version2.major = 1
        version2.minor = 1
        version2.label = "b"

        self.assertEqual(version1, sorted([version2, version1])[0])
Пример #4
0
    def test_define_changes_status(self):
        root_dto = RootDto()

        version1 = Version()
        version1.name = "v1"
        version1.major = 1
        version1 = VersionDto(version1)
        version2 = Version()
        version2.name = "v2"
        version2.major = 2
        version2 = VersionDto(version2)

        category1 = MethodCategory(Category("c1"))
        category2 = TypeCategory(Category("c2"))

        method1 = Method()
        method1.changes_status = {"v1": MultiVersion.Changes.none}
        method2 = Method()
        method2.changes_status = {"v1": MultiVersion.Changes.new}
        method3 = Method()
        method3.changes_status = {"v2": MultiVersion.Changes.new}

        category1.methods = [method1, method2, method3]

        root_dto.versions = [version1, version2]
        root_dto.method_categories = [category1]
        root_dto.type_categories = [category2]

        self.factory.define_changes_status(root_dto)

        self.assertEqual(MultiVersion.Changes.new,
                         method1.changes_status["v1"])
        self.assertEqual(MultiVersion.Changes.deleted,
                         method2.changes_status["v2"])
        self.assertEqual(MultiVersion.Changes.none,
                         method3.changes_status["v1"])
Пример #5
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)