Exemplo n.º 1
0
def test_live_instance_jwt():
    """
    Check that we are able to retrieve data from ROK's demo instance
    with a ROK Connector authenticated with a JWT
    """

    live_rc_jwt = RokConnector(
        name='RokConnector',
        host='',
        username='',
        secret='',
        authenticated_with_token=True,
    )

    live_rds = RokDataSource(
        name='RokConnector',
        domain='RokData',
        database='ToucanToco',
        query='{entities{company{companies{code}}}}',
        filter='.data.entities.company.companies',
        live_data=True,
    )

    df = live_rc_jwt.get_df(live_rds)
    assert len(df.values) > 1
Exemplo n.º 2
0
def rok_connector():
    return RokConnector(
        name='RokConnector',
        host='https://rok.example.com',
        username='******',
        password='******',
    )
Exemplo n.º 3
0
def rok_connector_with_secret():
    return RokConnector(
        name='RokConnector',
        host='https://rok.example.com',
        username='******',
        secret='mylittlesecret==',  # base64 encoded
        authenticated_with_token=True,
    )
Exemplo n.º 4
0
def test_live_instance():

    live_rds = RokDataSource(
        name='RokConnector',
        domain='RokData',
        database='ToucanToco',
        query='{entities{city{cities{code}}}}',
        filter='.data.entities.city.cities',
    )

    live_rc = RokConnector(
        name='RokConnector',
        host='',
        username='',
        password='',
    )

    df = live_rc.get_df(live_rds)
    print(df)
    assert len(df.values) > 1
Exemplo n.º 5
0
def test_live_instance():
    import os

    live_rds = RokDataSource(
        name='RokConnector',
        domain='RokData',
        database='ToucanToco',
        query='{entities{city{cities{code}}}}',
        filter='.data.entities.city.cities',
    )

    live_rc = RokConnector(
        name='RokConnector',
        host='https://demo.rok-solution.com',
        username=os.environ['CONNECTORS_TESTS_ROK_USERNAME'],
        password=os.environ['CONNECTORS_TESTS_ROK_PASSWORD'],
    )

    df = live_rc.get_df(live_rds)
    assert not df.empty
Exemplo n.º 6
0
import pytest
import responses

from toucan_connectors.rok.rok_connector import RokConnector, RokDataSource

rds = RokDataSource(
    name='RokConnector',
    domain='RokData',
    database='database',
    query='{some query}',
    filter='.data',
)

rc = RokConnector(
    name='RokConnector',
    host='https://rok.example.com',
    username='******',
    password='******',
)

endpoint = 'https://rok.example.com/graphql'


@responses.activate
def test_rok():

    responses.add(responses.POST,
                  endpoint,
                  json={'data': {
                      'authenticate': 'some_token'
                  }})
    responses.add(responses.POST, endpoint, json={'data': {'a': 1, 'b': 2}})