コード例 #1
0
def test_authentication_from_env_file():
    """
    Test authentication with bad path to `.env` file.

    Expect `FileNotFoundError`.
    """
    # Import third-party modules
    from pytest import raises

    with raises(FileNotFoundError) as invalidPath:
        Binance.from_env_file('noSuchPath/.env')

        err = ("No such file or directory: 'noSuchPath/.env'")
        err in str(invalidPath.value)
コード例 #2
0
def binance() -> Binance:
    """
    Instantiate `Binance` class.

    This object will be used throughout the testing of Binance API SDK.

    Currently, the API key and secret are sourced from a `.env` file.
    Since `.env` files are not being uploaded to project repositories, this
    has to change to sourcing the parameters from a vault.
    """
    dotenv = '.env'  # Relative path to `.env` file
    binance = Binance.from_env_file(dotenv)

    return binance