def test_empty_03(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info></info>''' result = XmlAppInfoParser().parse(text) assert isinstance(result, XmlAppInfo) _assert_XmlAppInfo_empty(result)
def test_authors_empty_ru_no_lang_full(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <author> <name>John</name> <email>[email protected]</email> <website>http://example.com</website> </author> <author lang='ru'> <name>Джон</name> <email>[email protected]</email> <website>http://example.com/ru</website> </author> </info>''' result = XmlAppInfoParser().parse(text) assert '' in result.authors.get_languages() assert 'ru' in result.authors.get_languages() assert len(result.authors.get_languages()) == 2 assert result.authors[''][0].name == 'John' assert result.authors[''][0].email == '*****@*****.**' assert result.authors[''][0].website == 'http://example.com' assert result.authors['ru'][0].name == 'Джон' assert result.authors['ru'][0].email == '*****@*****.**' assert result.authors['ru'][0].website == 'http://example.com/ru'
def test_website_empty(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <website></website> </info>''' result = XmlAppInfoParser().parse(text) assert result.website.get_languages() == [''] assert result.website[''] == ''
def test_name_en(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <name lang="en">Application name</name> </info>''' result = XmlAppInfoParser().parse(text) assert result.app_name.get_languages() == ['en'] assert result.app_name['en'] == 'Application name'
def test_version(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <version number="1.0" status="dev"/> </info>''' result = XmlAppInfoParser().parse(text) assert result.version.number == '1.0' assert result.version.status == 'dev'
def test_description_en(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <description lang="en">Description</description> </info>''' result = XmlAppInfoParser().parse(text) assert result.description.get_languages() == ['en'] assert result.description['en'] == 'Description'
def test_website_en(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <website lang="en">http://jenyay.net</website> </info>''' result = XmlAppInfoParser().parse(text) assert result.website.get_languages() == ['en'] assert result.website['en'] == 'http://jenyay.net'
def test_authors_empty_en(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <author lang='en'></author> </info>''' result = XmlAppInfoParser().parse(text) assert result.authors['en'][0].name == '' assert result.authors['en'][0].email == '' assert result.authors['en'][0].website == ''
def test_name_en_ru(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <name lang="en">Application name</name> <name lang="ru">Имя приложения</name> </info>''' result = XmlAppInfoParser().parse(text) assert 'en' in result.app_name.get_languages() assert 'ru' in result.app_name.get_languages() assert len(result.app_name.get_languages()) == 2 assert result.app_name['en'] == 'Application name' assert result.app_name['ru'] == 'Имя приложения'
def test_description_en_ru(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <description lang="en">Description</description> <description lang="ru">Описание</description> </info>''' result = XmlAppInfoParser().parse(text) assert 'en' in result.description.get_languages() assert 'ru' in result.description.get_languages() assert len(result.description.get_languages()) == 2 assert result.description['en'] == 'Description' assert result.description['ru'] == 'Описание'
def test_website_en_ru(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <website lang="en">http://jenyay.net/en/</website> <website lang="ru">http://jenyay.net/ru/</website> </info>''' result = XmlAppInfoParser().parse(text) assert 'en' in result.website.get_languages() assert 'ru' in result.website.get_languages() assert len(result.website.get_languages()) == 2 assert result.website['en'] == 'http://jenyay.net/en/' assert result.website['ru'] == 'http://jenyay.net/ru/'
def upload_plugin(*args): ''' Upload plugin to site ''' if len(args) == 0: args = PLUGINS_LIST version_str = getOutwikerVersionStr() for pluginname in args: path_to_plugin_local = os.path.join(BUILD_DIR, version_str, PLUGINS_DIR, pluginname) if not os.path.exists(path_to_plugin_local): continue path_to_xml_local = os.path.join(path_to_plugin_local, PLUGIN_VERSIONS_FILENAME) xml_content_local = readTextFile(path_to_xml_local) appinfo_local = XmlAppInfoParser().parse(xml_content_local) url = appinfo_local.updatesUrl try: appinfo_remote = downloadAppInfo(url) except Exception: appinfo_remote = None if (appinfo_remote is not None and appinfo_local.currentVersion < appinfo_remote.currentVersion): print_error(u'Error. New version < Prev version') sys.exit(1) elif (appinfo_remote is not None and appinfo_local.currentVersion == appinfo_remote.currentVersion): print_warning(u'Warning: Uploaded the same version') print_info(u'Uploading...') path_to_upload = os.path.dirname( appinfo_local.updatesUrl.replace(DEPLOY_SITE + u'/', DEPLOY_HOME_PATH)) version_local = str(appinfo_local.currentVersion) archive_name = u'{}-{}.zip'.format(pluginname, version_local) path_to_archive_local = os.path.join(path_to_plugin_local, archive_name) with cd(path_to_upload): put(path_to_archive_local, archive_name) put(path_to_xml_local, PLUGIN_VERSIONS_FILENAME) site_versions()
def test_authors_several(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <author> <name>John</name> <email>[email protected]</email> <website>http://example.com/john/en</website> </author> <author lang='ru'> <name>Джон</name> <email>[email protected]</email> <website>http://example.com/john/ru</website> </author> <author> <name>Andrey</name> <email>[email protected]</email> <website>http://example.com/andrey/en</website> </author> <author lang='ru'> <name>Андрей</name> <email>[email protected]</email> <website>http://example.com/andrey/ru</website> </author> </info>''' result = XmlAppInfoParser().parse(text) assert '' in result.authors.get_languages() assert 'ru' in result.authors.get_languages() assert len(result.authors.get_languages()) == 2 assert result.authors[''][0].name == 'John' assert result.authors[''][0].email == '*****@*****.**' assert result.authors[''][0].website == 'http://example.com/john/en' assert result.authors['ru'][0].name == 'Джон' assert result.authors['ru'][0].email == '*****@*****.**' assert result.authors['ru'][0].website == 'http://example.com/john/ru' assert result.authors[''][1].name == 'Andrey' assert result.authors[''][1].email == '*****@*****.**' assert result.authors[''][1].website == 'http://example.com/andrey/en' assert result.authors['ru'][1].name == 'Андрей' assert result.authors['ru'][1].email == '*****@*****.**' assert result.authors['ru'][1].website == 'http://example.com/andrey/ru'
def test_requirements_os_api(): text = '''<?xml version="1.1" encoding="UTF-8" ?> <info> <requirements> <os>Windows</os> <os>Linux</os> <api>3.666</api> <api>3.667</api> </requirements> </info>''' result = XmlAppInfoParser().parse(text) assert 'Windows' in result.requirements.os_list assert 'Linux' in result.requirements.os_list assert (3, 666) in result.requirements.api_list assert (3, 667) in result.requirements.api_list
def test_empty_01(): text = "" result = XmlAppInfoParser().parse(text) # type: XmlAppInfo assert isinstance(result, XmlAppInfo) _assert_XmlAppInfo_empty(result)