forked from harvester/tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_endpoints.py
66 lines (55 loc) · 2.3 KB
/
api_endpoints.py
1
2
3
4
5
6
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright (c) 2021 SUSE LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact SUSE LLC.
#
# To contact SUSE about this file by physical or electronic mail,
# you may find current contact information at www.suse.com
from harvester_e2e_tests import utils
import pytest
pytest_plugins = [
'harvester_e2e_tests.fixtures.api_version',
]
# NOTE: see Swagger API doc here
# https://docs.harvesterhci.io/v0.2/reference/api/
class HarvesterAPIEndpoints:
def __init__(self, endpoint, harvester_api_version,
cdi_api_version, kubevirt_api_version):
self.harvester_endpoint = endpoint
self.__dict__.update(
utils.get_json_object_from_template(
'api_endpoints',
harvester_endpoint=self.harvester_endpoint,
harvester_api_version=harvester_api_version,
cdi_api_version=cdi_api_version,
kubevirt_api_version=kubevirt_api_version
)
)
@pytest.fixture(scope='session')
def harvester_api_endpoints(request, harvester_api_version,
cdi_api_version, kubevirt_api_version):
harvester_endpoint = request.config.getoption('--endpoint')
return HarvesterAPIEndpoints(harvester_endpoint, harvester_api_version,
cdi_api_version, kubevirt_api_version)
class RancherAPIEndpoints:
def __init__(self, rancher_endpoint):
self.rancher_endpoint = rancher_endpoint
self.__dict__.update(
utils.get_json_object_from_template(
'rancher_api_endpoints',
rancher_endpoint=rancher_endpoint
)
)
@pytest.fixture(scope='session')
def rancher_api_endpoints(request):
rancher_endpoint = request.config.getoption('--rancher-endpoint')
return RancherAPIEndpoints(rancher_endpoint)