def test_post_with_timeout(self): """Tests the post method""" responses.add(**SessionTestCase.post_responses_inp) sess = ArmadaSession("testarmada") result = sess.post('bogus', timeout=(60, 60)) assert result.status_code == 200 return True
def test_get(self): """Tests the get method""" responses.add(**SessionTestCase.get_responses_inp) sess = ArmadaSession("testarmada") result = sess.get('bogus') assert result.status_code == 200 return True
def test_timeout(self): """Tests the _timeout method""" sess = ArmadaSession("testarmada") resp = sess._timeout((60, 70)) assert resp == (60, 70) resp = sess._timeout() assert resp == (20, 3600)
def main(ctx, debug, api, url, token): """ Multi Helm Chart Deployment Manager Common actions from this point include: \b $ armada apply $ armada delete $ armada test $ armada tiller $ armada validate Environment: \b $TOKEN set auth token $HOST set armada service host endpoint This tool will communicate with deployed Tiller in your Kubernetes cluster. """ if not ctx.obj: ctx.obj = {} if api: if not url or not token: raise click.ClickException( 'When api option is enable user needs to pass url') else: ctx.obj['api'] = api parsed_url = urlparse(url) ctx.obj['CLIENT'] = ArmadaClient( ArmadaSession( host=parsed_url.netloc, scheme=parsed_url.scheme, token=token) ) log.register_options(CONF) if debug: CONF.debug = debug log.set_defaults(default_log_levels=CONF.default_log_levels) log.setup(CONF, 'armada')
def test_create_session(self): """Tests setting up an Armada session""" sess = ArmadaSession("testarmada") assert sess.default_timeout == (20, 3600) sess = ArmadaSession("testarmada", timeout=60) assert sess.default_timeout == (20, 60) sess = ArmadaSession("testarmada", timeout=(300, 300)) assert sess.default_timeout == (300, 300) sess = ArmadaSession("testarmada", timeout=("cheese", "chicken")) assert sess.default_timeout == (20, 3600) sess = ArmadaSession("testarmada", timeout=(30, 60, 90)) assert sess.default_timeout == (20, 3600) sess = ArmadaSession("testarmada", timeout="cranium") assert sess.default_timeout == (20, 3600)