Exemplo n.º 1
0
def test_getQrCode_invalidCode(maintainConfig):
    config = getConfiguration()
    config.set("login", "qrCode", "None")
    with open("config.ini", "w") as configFile:
        config.write(configFile)

    config = getConfiguration()
    qrCode = getQrCode()

    assert qrCode == None
Exemplo n.º 2
0
def test_getQrCode_validCode(maintainConfig):
    config = getConfiguration()
    config.set("login", "qrCode", "AAAA1111BBBB2222")
    with open("config.ini", "w") as configFile:
        config.write(configFile)

    qrCode = getQrCode()

    assert qrCode == "AAAA1111BBBB2222"
Exemplo n.º 3
0
def test_getQrCode_NoCode(maintainConfig):
    config = getConfiguration()
    config.remove_option("login", "qrCode")
    with open("config.ini", "w") as configFile:
        config.write(configFile)

    qrCode = getQrCode()

    assert qrCode == None
Exemplo n.º 4
0
def test_getConfiguration(maintainConfig):
    config = getConfiguration()

    assert type(config).__name__ == "ConfigParser"
    assert "login" in config.keys()
    assert "qrCodePattern" in config["login"].keys()
Exemplo n.º 5
0
from .RobinhoodTrader import RobinhoodTrader
from RobinhoodTrader.config import getConfiguration
from RobinhoodTrader import apiEndpoints, nummusEndpoints
import pprint, os, shutil, requests, json

printer = pprint.PrettyPrinter(indent=4)
os.chdir("RobinhoodTrader/")
shutil.copy2("config.ini", "config.ini.bak")
if os.path.isfile("myConfig.ini"):
    os.remove("config.ini")
    shutil.copy2("myConfig.ini", "config.ini")

try:
    trader = RobinhoodTrader()
    config = getConfiguration()
    username = config.get("login", "username", fallback=None)
    password = config.get("login", "password", fallback=None)
    credentials = (username, password)
    trader.login(credentials)

    data = trader.cryptoBroker.getWatchlistCurrencyPairIds()
    printer.pprint(data)

    data = trader.cryptoBroker.addToWatchlist(
        "b9729798-2aec-4ca9-8637-4d9789d63764")
    printer.pprint(data)

    data = trader.cryptoBroker.getWatchlistCurrencyPairIds()
    printer.pprint(data)

except Exception: