I am can't find out a way how to init my ApiClient
with the value of context.config.userdata['url']
from behave.ini
behave.ini
[behave.userdata]
url=http://some.url
steps.py
from behave import *
from client.api_client import ApiClient
# This is where i want to pass the config.userdata['url'] value
api_calls = ApiClient('???')
@given('I am logged as "{user}" "{password}"')
def login(context, user, password):
context.auth_header = api_calls.auth(user, password)
api_client.py
class ApiClient(object):
def __init__(self, url):
self.url = url
def auth(self, email, password):
auth_payload = {'email': email, 'password': password}
auth_response = requests.post(self.url + '/api/auth/session', auth_payload)
return auth_response.text