conftest.py 937 Bytes
Newer Older
Jo Sama's avatar
Jo Sama committed
1
2
3
4
5
import pytest
import os
import json

from topdesk_client import get_client
Jo Sama's avatar
Jo Sama committed
6
from topdesk_client.models import Operator
Jo Sama's avatar
Jo Sama committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

# @pytest.fixture
# def request():
#     return requests.Request()


@pytest.fixture
def base_url():
    return 'https://localhost'


@pytest.fixture
def config(base_url):
    return {
        'url': base_url,
    }


@pytest.fixture
def client(config):
    return get_client(config)


def load_json_file(name):
    here = os.path.realpath(os.path.join(os.getcwd(),
                                         os.path.dirname(__file__)))
    with open(os.path.join(here, 'fixtures', name)) as f:
        data = json.load(f)
    return data


@pytest.fixture
def operator_data():
    return load_json_file('operator.json')


Jo Sama's avatar
Jo Sama committed
43
44
45
46
47
48
@pytest.fixture
def operator():
    d = load_json_file('operator.json')
    return Operator.from_dict(d)


Jo Sama's avatar
Jo Sama committed
49
50
51
@pytest.fixture
def operator_list_data():
    return load_json_file('operator_list.json')