Beispiel #1
0
def test_markets_schema():
    """validate /markets endpoint"""
    result = helpers.raw_request_get(endpoint='markets')

    schema = helpers.load_schema('markets.schema')

    jsonschema.validate(result, schema)
Beispiel #2
0
def test_instruments_schema():
    """validate /instruments endpoint"""
    # TODO: instruments from API ROOT
    result = helpers.raw_request_get(endpoint='instruments')

    schema = helpers.load_schema('instruments.schema')

    jsonschema.validate(result, schema)
Beispiel #3
0
def test_prod_crawler_pub():
    """validate we can spawn a prod crawler"""
    endpoint = crawler.Endpoint()

    fundamentals = endpoint.instruments.results[0].fundamentals._data

    schema = helpers.load_schema('fundamentals.schema')

    jsonschema.validate(fundamentals, schema['properties']['results']['items'],)
Beispiel #4
0
def test_quotes_schema():
    """validate /quotes endpoint"""
    # TODO: not on API ROOT?
    result = helpers.raw_request_get(
        endpoint='quotes',
        params={'symbols': helpers.CONFIG.get('tests', 'good_stock_list')})

    schema = helpers.load_schema('quotes.schema')

    jsonschema.validate(result, schema)
Beispiel #5
0
def test_news_schema():
    """validate /midlands/news/ endpoint"""
    # TODO: not on API ROOT?
    result = helpers.raw_request_get(
        endpoint_url='https://api.robinhood.com/midlands/news/',
        params={'symbol': helpers.CONFIG.get('tests', 'good_stock')})

    schema = helpers.load_schema('news.schema')

    jsonschema.validate(result, schema)
Beispiel #6
0
def test_fundamentals_schema():
    """validate /fundamentals endpoint"""
    result = helpers.raw_request_get(
        endpoint_url='https://api.robinhood.com/fundamentals/',
        params={'symbols': helpers.CONFIG.get('tests', 'good_stock_list')},
    )

    schema = helpers.load_schema('fundamentals.schema')

    jsonschema.validate(result, schema)
Beispiel #7
0
def test_dividends_schema():
    """validate /dividends endpoint"""
    token = helpers.xfail_can_auth()

    result = helpers.raw_request_get(
        endpoint='dividends',
        headers={'Authorization': 'Token ' + token},
    )

    schema = helpers.load_schema('dividends.schema')

    jsonschema.validate(result, schema)
Beispiel #8
0
def test_prod_crawler_auth():
    """validate auth crawler on prod"""
    helpers.xfail_can_auth()

    endpoint = crawler.Endpoint(
        username=helpers.CONFIG.get('robinhood', 'username'),
        password=helpers.CONFIG.get('robinhood', 'password'),
    )

    positions = endpoint.accounts.results[0].positions._data

    schema = helpers.load_schema('positions.schema')

    jsonschema.validate(positions, schema)