def test_set_version_03():
    text_src = io.StringIO('''<?xml version='1.0' encoding='UTF-8'?>
<versions>
    <version number="3.1.0.891">
        <changes>
        </changes>

        <changes lang="ru">
        </changes>
    </version>
</versions>''')

    version = [1, 2, 3, 4]
    status = 'beta'

    text_expected = '''<?xml version='1.0' encoding='UTF-8'?>
<versions>
    <version number="1.2.3.4" status="beta">
        <changes>
        </changes>

        <changes lang="ru">
        </changes>
    </version>
</versions>'''

    updater = VersionsXmlUpdater()
    new_content = updater.set_version(text_src, version, status)

    assert new_content == text_expected
def test_set_release_date_02():
    text_src = io.StringIO('''<?xml version='1.0' encoding='UTF-8'?>
<versions>
    <version number="3.1.0.891" status="dev" date="01.01.2021">
        <changes>
        </changes>

        <changes lang="ru">
        </changes>
    </version>
</versions>''')

    date_str = '08.07.2021'

    text_expected = '''<?xml version='1.0' encoding='UTF-8'?>
<versions>
    <version number="3.1.0.891" status="dev" date="08.07.2021">
        <changes>
        </changes>

        <changes lang="ru">
        </changes>
    </version>
</versions>'''

    updater = VersionsXmlUpdater()
    new_content = updater.set_release_date(text_src, date_str)

    assert new_content == text_expected
Example #3
0
def _get_version_updaters():
    return [
        (Path('src', 'outwiker', '__init__.py'), InitUpdater()),
        (Path('need_for_build', 'versions.xml'), VersionsXmlUpdater()),
        (Path('need_for_build', 'linux',
              'net.jenyay.Outwiker.appdata.xml'), AppDataXmlUpdater()),
    ]