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
def rok_ds(): return RokDataSource( name='RokConnector', domain='RokData', database='database', query='{some query}', filter='.data', )
def rok_ds_jwt(): return RokDataSource( name='RokConnector', domain='RokData', database='database', query='{some query}', filter='.data.entities.company.companies', live_data=True, )
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
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
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' }})