def test_ready(): with captured_output() as (out, err): Sdk("apikey").ready() output = out.getvalue().strip() assert_equal( output, "Welcome to Convect!\n\nHead to https://app.convect.ml to start deploying models." )
def test_ready(): with patch.object(sys, 'argv', ['blah/convect', 'ready']): with captured_output() as (out, err): main() output = out.getvalue().strip() assert_equal( output, "Welcome to Convect!\n\nHead to https://app.convect.ml to start deploying models." )
def test_deploy_bad_session(): with captured_output() as (out, err): deploy_result = Sdk("apikey").deploy(model=reg, sample_inputs=[{ 'a': 0, 'b': 1 }, { 'a': 1, 'b': 2 }]) output = out.getvalue().strip() assert_true(output.startswith('"newsgroups" is')) assert_is_none(deploy_result)
def test_deploy_bad_response(mocked_post): mocked_post.return_value = Mock(status_code=400, raise_for_status=lambda: (raise_(HTTPError('error')))) with captured_output() as (out, err): assert_raises(HTTPError, Sdk("apikey").deploy, model=reg, sample_inputs=[{ 'a': 0, 'b': 1 }, { 'a': 1, 'b': 2 }]) output = out.getvalue().strip()
def test_invalid(): with patch.object(sys, 'argv', ['blah/convect', 'asdf']): with captured_output() as (out, err): main() output = out.getvalue().strip() assert_equal(output, "Invalid usage of convect. Try:\n\nconvect ready")