示例#1
0
    def test_issue88(self):
        # Here, load the same file twice.
        # All entries in these two lists should be duplicates of each other.
        objects_from_repo_a = Modulemd.objects_from_file(
            '%s/test_data/issue88.yaml' % os.getenv('MESON_SOURCE_ROOT'))
        objects_from_repo_b = Modulemd.objects_from_file(
            '%s/test_data/issue88.yaml' % os.getenv('MESON_SOURCE_ROOT'))

        # Test at the same priority level
        prioritizer = Modulemd.Prioritizer()
        prioritizer.add(objects_from_repo_a, 0)
        prioritizer.add(objects_from_repo_b, 0)
        supposedly_merged_objects = prioritizer.resolve()

        # Since they are all duplicates, they should be the same size.
        assert len(objects_from_repo_a) == len(objects_from_repo_b)
        assert len(objects_from_repo_a) == len(supposedly_merged_objects)

        # Test at different priorities
        prioritizer = Modulemd.Prioritizer()
        prioritizer.add(objects_from_repo_a, 0)
        prioritizer.add(objects_from_repo_b, 1)
        supposedly_merged_objects = prioritizer.resolve()

        # Since they are all duplicates, they should be the same size.
        assert len(objects_from_repo_a) == len(objects_from_repo_b)
        assert len(objects_from_repo_a) == len(supposedly_merged_objects)
示例#2
0
    def test_latest_version(self):
        # Load YAML with two versions of the same (name, stream, context)
        objects = Modulemd.objects_from_file(
            '%s/test_data/latest_version.yaml' %
            os.getenv('MESON_SOURCE_ROOT'))

        prioritizer = Modulemd.Prioritizer()
        prioritizer.add(objects, 0)

        supposedly_merged_objects = prioritizer.resolve()

        # There should only be the latest one in the list
        print(supposedly_merged_objects)

        assert len(supposedly_merged_objects) == 1
        assert supposedly_merged_objects[0].props.name == 'foo'
        assert supposedly_merged_objects[0].props.stream == 'stream-name'
        assert supposedly_merged_objects[0].props.context == 'c0ffee43'
        assert supposedly_merged_objects[0].props.version == 20180928144203