示例#1
0
def test_fromXmlAppInfo_app_info_version():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.version = XmlVersionInfo('1.0.1', status='beta')
    language = ''
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.version == Version(1, 0, 1, status=StatusSet.BETA)
示例#2
0
def test_fromXmlAppInfo_app_name():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.app_name.set_for_language('en', 'John')
    language = 'en'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.app_name == 'John'
示例#3
0
def test_fromXmlAppInfo_description():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.description.set_for_language('en', 'bla-bla-bla')
    language = 'en'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.description == 'bla-bla-bla'
示例#4
0
def test_fromXmlAppInfo_website_missing():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.website.set_for_language('en', 'http://example.com')
    language = 'ru'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.website == ''
示例#5
0
def test_fromXmlAppInfo_app_name_alternative_02():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.app_name.set_for_language('en', 'John')
    xmlAppInfo.app_name.set_for_language('en_US', 'John Smith')
    language = 'en_US'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.app_name == 'John Smith'
示例#6
0
def test_fromXmlAppInfo_description_default():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.description.set_for_language('', 'bla-bla-bla')
    xmlAppInfo.description.set_for_language('ru', 'бла-бла-бла')
    language = 'jp'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.description == 'bla-bla-bla'
示例#7
0
def test_fromXmlAppInfo_website_default():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.website.set_for_language('', 'http://example.com')
    xmlAppInfo.website.set_for_language('jp', 'http://example.com/jp')
    language = 'ru_RU'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.website == 'http://example.com'
示例#8
0
def test_fromXmlAppInfo_website_lang_alternative():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.website.set_for_language('en', 'http://example.com')
    xmlAppInfo.website.set_for_language('ru', 'http://example.com/ru')
    language = 'ru_RU'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.website == 'http://example.com/ru'
示例#9
0
def test_fromXmlAppInfo_requirements_several():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.requirements.os_list = ['Windows', 'Linux']
    xmlAppInfo.requirements.api_list = [(3, 868), (2, 800)]

    language = 'en'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.requirements.os_list == ['Windows', 'Linux']
    assert appInfo.requirements.api_list == [(3, 868), (2, 800)]
示例#10
0
def test_fromXmlAppInfo_requirements_single():
    xmlAppInfo = XmlAppInfo()
    xmlAppInfo.requirements.os_list = ['Windows']
    xmlAppInfo.requirements.api_list = [(3, 868)]

    language = 'en'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.requirements.os_list == ['Windows']
    assert appInfo.requirements.api_list == [(3, 868)]
示例#11
0
def test_fromXmlAppInfo_empty():
    xmlAppInfo = XmlAppInfo()
    language = ''
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.app_name == ''
    assert appInfo.website == ''
    assert appInfo.description == ''
    assert appInfo.authors == []
    assert appInfo.requirements.os_list == []
    assert appInfo.requirements.api_list == []
    assert appInfo.version is None
示例#12
0
def test_fromXmlAppInfo_authors():
    xmlAppInfo = XmlAppInfo()
    author_en = XmlAuthorInfo(name='John',
                              email='*****@*****.**',
                              website='http://example.com')
    xmlAppInfo.authors.set_for_language('en', [author_en])

    language = 'en'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.authors[0].name == 'John'
    assert appInfo.authors[0].email == '*****@*****.**'
    assert appInfo.authors[0].website == 'http://example.com'
示例#13
0
def test_fromXmlAppInfo_authors_default():
    xmlAppInfo = XmlAppInfo()

    author_default = XmlAuthorInfo(name='John',
                                   email='*****@*****.**',
                                   website='http://example.com')
    xmlAppInfo.authors.set_for_language('', [author_default])

    author_ru = XmlAuthorInfo(name='Джон',
                              email='*****@*****.**',
                              website='http://example.com/ru')
    xmlAppInfo.authors.set_for_language('ru', [author_ru])

    language = 'jp'
    appInfo = AppInfoFactory.fromXmlAppInfo(xmlAppInfo, language)

    assert appInfo.authors[0].name == 'John'
    assert appInfo.authors[0].email == '*****@*****.**'
    assert appInfo.authors[0].website == 'http://example.com'