Esempio n. 1
0
def forbidden_sim():
    config = ServiceConfig()
    config.server = 'http://127.0.0.1:9000'
    config.workspace = 'forbidden'
    config.access_key = '1111'
    sim = MinimalSim(config)
    return sim
Esempio n. 2
0
def unauthorized_sim():
    config = ServiceConfig()
    config.server = 'http://127.0.0.1:9000'
    config.workspace = 'unauthorized'
    config.access_key = '1111'
    sim = MinimalSim(config)
    return sim
Esempio n. 3
0
def minimal_sim():
    config = ServiceConfig(argv=[__name__])
    config.server = 'https://testingBonsaiPyClient.bons.ai'
    config.workspace = 'minimal_sim'
    config.access_key = '1111'
    sim = MinimalSim(config)
    return sim
Esempio n. 4
0
def internal_server_err_sim():
    config = ServiceConfig()
    config.server = 'http://127.0.0.1:9000'
    config.workspace = '500'
    config.access_key = '1111'
    sim = MinimalSim(config)
    return sim
Esempio n. 5
0
def test_config_reads_args():
    config = ServiceConfig(argv=[
        __name__, '--accesskey', '111', '--api-host', 'host', '--workspace',
        'test', '--sim-context', 'context', '--retry-timeout', '30'
    ])
    assert config.access_key == '111'
    assert config.server == 'host'
    assert config.workspace == 'test'
    assert config.simulator_context == 'context'
    assert config.retry_timeout_seconds == 30
Esempio n. 6
0
def test_config_reads_env_vars():
    with patch.dict(
            'os.environ', {
                'SIM_ACCESS_KEY': '111',
                'SIM_API_HOST': 'https://bonsai-api.com',
                'SIM_WORKSPACE': '777',
                'SIM_CONTEXT': 'TRAIN'
            }):
        config = ServiceConfig()
        assert config.access_key == '111'
        assert config.server == 'https://bonsai-api.com'
        assert config.workspace == '777'
Esempio n. 7
0
def gateway_timeout_sim():
    config = ServiceConfig()
    config.server = 'http://127.0.0.1:9000'
    config.workspace = 'gatewaytimeout'
    config.access_key = '1111'
    config.retry_timeout_seconds = 0
    sim = MinimalSim(config)
    return sim
Esempio n. 8
0
def do_not_retry_sim():
    config = ServiceConfig(argv=[__name__])
    config.server = 'https://testingBonsaiPyClient.bons.ai'
    config.workspace = 'no_retry'
    config.access_key = '1111'
    config.retry_timeout_seconds = 0
    sim = MinimalSim(config)
    return sim
Esempio n. 9
0
def test_default_config():
    config = ServiceConfig()
    assert config.workspace == ''