예제 #1
0
def test_app_init(magic, config, logger, env, always_pull_images):
    services = magic()
    stories = magic()
    expected_secrets = {}
    if env:
        for k, v in env.items():
            if not isinstance(v, dict):
                expected_secrets[k.lower()] = v

    version = 100
    app_config = magic()
    config.APP_DOMAIN = 'asyncyapp.com'

    app = App(
        app_data=AppData(release=Release(app_uuid='app_id',
                                         app_name='app_name',
                                         app_dns='app_dns',
                                         version=version,
                                         stories=stories,
                                         always_pull_images=always_pull_images,
                                         environment=env,
                                         owner_uuid='owner_1',
                                         owner_email='*****@*****.**',
                                         maintenance=False,
                                         deleted=False,
                                         state='QUEUED'),
                         app_config=app_config,
                         services=services,
                         config=config,
                         logger=logger))

    if env is None:
        env = {}

    assert app.app_id == 'app_id'
    assert app.app_dns == 'app_dns'
    assert app.config == config
    assert app.logger == logger
    assert app.owner_uuid == 'owner_1'
    assert app.owner_email == '*****@*****.**'
    assert app.stories == stories['stories']
    assert app.services == services
    assert app.always_pull_images == always_pull_images
    assert app.environment == env
    assert app.app_context['hostname'] == f'{app.app_dns}.asyncyapp.com'
    assert app.app_context['version'] == version
    assert app.app_context['secrets'] == expected_secrets
    assert app.entrypoint == stories['entrypoint']
    assert app.app_config == app_config

    if always_pull_images is True:
        assert app.image_pull_policy() == 'Always'
    else:
        assert app.image_pull_policy() == 'IfNotPresent'
예제 #2
0
def test_app_init(magic, config, logger, env):
    services = magic()
    stories = magic()
    expected_secrets = {}
    if env:
        for k, v in env.items():
            if not isinstance(v, dict):
                expected_secrets[k.lower()] = v

    version = 100
    app_config = magic()
    config.APP_DOMAIN = 'asyncyapp.com'
    app = App('app_id', 'app_dns', version, config, logger, stories, services,
              env, 'owner_1', app_config)

    if env is None:
        env = {}

    assert app.app_id == 'app_id'
    assert app.app_dns == 'app_dns'
    assert app.config == config
    assert app.logger == logger
    assert app.owner_uuid == 'owner_1'
    assert app.stories == stories['stories']
    assert app.services == services
    assert app.environment == env
    assert app.app_context['hostname'] == f'{app.app_dns}.asyncyapp.com'
    assert app.app_context['version'] == version
    assert app.app_context['secrets'] == expected_secrets
    assert app.entrypoint == stories['entrypoint']
    assert app.app_config == app_config
예제 #3
0
def app(config, logger, magic):
    return App(app_data=AppData(
        app_id='app_id',
        app_name='app_name',
        app_dns='app_dns',
        config=config,
        logger=logger,
        version=magic(),
        stories=magic(),
        services={},
        owner_uuid='owner_uuid',
        owner_email='*****@*****.**',
        environment={},
        app_config=magic()
    ))
예제 #4
0
def app(config, logger, magic):
    return App(
        app_data=AppData(release=Release(app_uuid='app_uuid',
                                         app_name='app_name',
                                         app_dns='app_dns',
                                         owner_uuid='owner_uuid',
                                         owner_email='*****@*****.**',
                                         environment={},
                                         stories=magic(),
                                         version=magic(),
                                         always_pull_images=False,
                                         maintenance=False,
                                         deleted=False,
                                         state='QUEUED'),
                         config=config,
                         logger=logger,
                         services={},
                         app_config=magic()))
예제 #5
0
def test_app_init(magic, config, logger, env):
    services = magic()
    stories = magic()
    expected_secrets = {}
    if env:
        for k, v in env.items():
            if not isinstance(v, dict):
                expected_secrets[k.lower()] = v

    app = App('app_id', 'app_dns', logger, config, logger, stories, services,
              env)
    assert app.app_id == 'app_id'
    assert app.app_dns == 'app_dns'
    assert app.config == config
    assert app.logger == logger
    assert app.stories == stories['stories']
    assert app.services == services
    assert app.environment == env
    assert app.app_context['secrets'] == expected_secrets
    assert app.entrypoint == stories['entrypoint']
예제 #6
0
def app(config, logger, magic):
    return App('app_id', 'app_dns', logger, config, magic(), magic(), magic(),
               {}, 'owner_uuid', magic())