Exemple #1
0
def to_app(app):
    app_version = AppVersions()
    app_version.installed_version = app['version']
    app_version.current_version = app['version']
    app_version.app = App()
    app_version.app.id = app['name']
    return app_version
Exemple #2
0
def test_apps_to_certbot_domain_args():

    app_versions = AppVersions()
    app_versions.app = App()
    app_versions.app.id = 'app1'

    domain_args = apps_to_certbot_domain_args([app_versions], 'domain')

    assert domain_args.startswith(
        '-d domain '), 'master domain should be first'
Exemple #3
0
    def to_app(self, id, name, channel, installed_version, store_version):

        newapp = App()
        newapp.id = id
        newapp.name = name
        newapp.url = self.info.url(newapp.id)
        newapp.icon = "http://apps.syncloud.org/releases/{0}/images/{1}-128.png".format(
            channel, newapp.id)

        app_version = AppVersions()
        app_version.installed_version = installed_version
        app_version.current_version = store_version
        app_version.app = newapp

        return app_version
Exemple #4
0
    def to_app(self, id, name, channel, installed_version, store_version):

        new_app = App()
        new_app.id = id
        new_app.name = name
        new_app.url = self.info.url(id)
        new_app.icon = "/rest/app_image?channel={0}&app={1}".format(
            channel, id)

        app_version = AppVersions()
        app_version.installed_version = installed_version
        app_version.current_version = store_version
        app_version.app = new_app

        return app_version
Exemple #5
0
def test_join_apps():

    installed_app1 = App()
    installed_app1.id = 'id1'
    installed_app_version1 = AppVersions()
    installed_app_version1.installed_version = 'v1'
    installed_app_version1.current_version = None
    installed_app_version1.app = installed_app1

    installed_app2 = App()
    installed_app2.id = 'id2'
    installed_app_version2 = AppVersions()
    installed_app_version2.installed_version = 'v1'
    installed_app_version2.current_version = None
    installed_app_version2.app = installed_app2

    installed_apps = [installed_app_version1, installed_app_version2]

    store_app2 = App()
    store_app2.id = 'id2'
    store_app_version2 = AppVersions()
    store_app_version2.installed_version = None
    store_app_version2.current_version = 'v2'
    store_app_version2.app = store_app2

    store_app3 = App()
    store_app3.id = 'id3'
    store_app_version3 = AppVersions()
    store_app_version3.installed_version = None
    store_app_version3.current_version = 'v2'
    store_app_version3.app = store_app3

    store_apps = [store_app_version2, store_app_version3]

    all_apps = sorted(join_apps(installed_apps, store_apps),
                      key=lambda app: app.app.id)

    assert len(all_apps) == 3

    assert all_apps[0].app.id == 'id1'
    assert all_apps[0].installed_version == 'v1'
    assert all_apps[0].current_version is None

    assert all_apps[1].app.id == 'id2'
    assert all_apps[1].installed_version == 'v1'
    assert all_apps[1].current_version == 'v2'

    assert all_apps[2].app.id == 'id3'
    assert all_apps[2].installed_version is None
    assert all_apps[2].current_version == 'v2'