Exemplo n.º 1
0
def test_configure_confirm_no(mock_confirm, capsys):
    with fake_creds():
        creds = read_creds()
        configure()

        # Check that creds were not modified
        assert read_creds() == creds

        expected_result = dedent("""
        [jovian] It looks like Jovian is already configured ( check ~/.jovian/credentials.json ).
        [jovian] Skipping..
        """).strip()
        captured = capsys.readouterr()
        assert captured.out.strip() == expected_result.strip()
Exemplo n.º 2
0
def test_configure_no_creds(mock_prompt, mock_validate_api_key, mock_get, capsys):
    with fake_creds():
        purge_creds()

        configure()

        assert read_creds() == {'API_KEY': 'fake_api_key',
                                'API_URL': 'https://api-staging.jovian.ai',
                                'GUEST_KEY': ANY,
                                'ORG_ID': 'staging',
                                'WEBAPP_URL': 'https://staging.jovian.ai/'}

        expected_result = dedent("""
        [jovian] If you're a jovian-pro user please enter your company's organization ID on Jovian (otherwise leave it blank).
        [jovian] Please enter your API key ( from https://staging.jovian.ai/ ):
        [jovian] Configuration complete!
        """).strip()

        captured = capsys.readouterr()
        assert captured.out.strip() == expected_result.strip()
Exemplo n.º 3
0
def test_configure_confirm_yes(mock_confirm, mock_prompt,
                               mock_validate_api_key, mock_get, capsys):
    with fake_creds():
        configure()

        assert read_creds() == {
            'API_KEY': 'fake_api_key',
            'API_URL': 'https://api-staging.jovian.ai',
            'GUEST_KEY': ANY,
            'ORG_ID': 'staging',
            'WEBAPP_URL': 'https://staging.jovian.ml/'
        }

        expected_result = dedent("""
        [jovian] It looks like Jovian is already configured ( check ~/.jovian/credentials.json ).
        [jovian] Removing existing configuration..
        [jovian] If you're a jovian-pro user please enter your company's organization ID on Jovian (otherwise leave it blank).
        [jovian] Please enter your API key ( from https://staging.jovian.ml/ ):
        [jovian] Configuration complete!
        """).strip()

        captured = capsys.readouterr()
        assert captured.out.strip() == expected_result.strip()
Exemplo n.º 4
0
def create_config(ctx):
    """Configure Jovian for Pro users."""

    configure()