Skip to content

Commit

Permalink
docs: provide feedback when calling algokit explore
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-makerx committed Mar 29, 2023
1 parent ce9ebea commit def4ef5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/algokit/cli/explore.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import logging
from typing import TypedDict
from urllib.parse import urlencode

import click

from algokit.core.sandbox import DEFAULT_ALGOD_PORT, DEFAULT_ALGOD_SERVER, DEFAULT_ALGOD_TOKEN, DEFAULT_INDEXER_PORT

logger = logging.getLogger(__name__)


class NetworkConfigurationRequired(TypedDict):
algod_url: str
Expand Down Expand Up @@ -48,4 +51,5 @@ def get_dappflow_url(network: NetworkConfiguration) -> str:
@click.argument("network", type=click.Choice(list(NETWORKS)), default="localnet", required=False)
def explore_command(network: str) -> None:
url = get_dappflow_url(NETWORKS[network])
logger.info(f"Opening {network} in https://app.dappflow.org using default browser")
click.launch(url)
6 changes: 5 additions & 1 deletion tests/explore/test_explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from approvaltests.namer import NamerFactory
from pytest_mock import MockerFixture

from tests import get_combined_verify_output
from tests.utils.approvals import verify
from tests.utils.click_invoker import invoke

Expand All @@ -12,4 +13,7 @@ def test_explore(command: str, mocker: MockerFixture) -> None:
result = invoke(f"explore {command}")

assert result.exit_code == 0
verify(launch_mock.call_args, options=NamerFactory.with_parameters(command or "localnet"))
verify(
get_combined_verify_output(result.output, "launch args", launch_mock.call_args),
options=NamerFactory.with_parameters(command or "localnet"),
)
4 changes: 4 additions & 0 deletions tests/explore/test_explore.test_explore.localnet.approved.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
Opening localnet in https://app.dappflow.org using default browser
----
launch args:
----
call('https://app.dappflow.org/setup-config?algod_url=http%3A%2F%2Flocalhost&indexer_url=http%3A%2F%2Flocalhost&algod_port=4001&algod_token=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&indexer_port=8980&indexer_token=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
4 changes: 4 additions & 0 deletions tests/explore/test_explore.test_explore.mainnet.approved.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
Opening mainnet in https://app.dappflow.org using default browser
----
launch args:
----
call('https://app.dappflow.org/setup-config?algod_url=https%3A%2F%2Fmainnet-api.algonode.cloud&indexer_url=https%3A%2F%2Fmainnet-idx.algonode.cloud')
4 changes: 4 additions & 0 deletions tests/explore/test_explore.test_explore.testnet.approved.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
Opening testnet in https://app.dappflow.org using default browser
----
launch args:
----
call('https://app.dappflow.org/setup-config?algod_url=https%3A%2F%2Ftestnet-api.algonode.cloud&indexer_url=https%3A%2F%2Ftestnet-idx.algonode.cloud')

0 comments on commit def4ef5

Please sign in to comment.