blob: d5ed4ae432a9d71143f6c43552b15fed4c59c304 [file] [log] [blame]
Wludzik, Jozef405c1e42021-01-28 16:24:27 +01001import pytest
2import redfish_requests
3
4
5def pytest_addoption(parser):
6 parser.addoption('--host_addr', action='store',
7 default='https://localhost:4443')
8 parser.addoption('--username', action='store', default='root')
9 parser.addoption('--password', action='store', default='0penBmc')
10 parser.addoption('--metric_limit', action='store', default=200)
11
12
13@pytest.fixture(scope='session')
14def redfish(request):
15 host_addr = request.config.getoption('--host_addr')
16 username = request.config.getoption('--username')
17 password = request.config.getoption('--password')
18 return redfish_requests.RedfishRequest(host_addr, username, password)
19
20
21@pytest.fixture(scope='session')
22def telemetry(request, redfish):
23 metric_limit = request.config.getoption('--metric_limit')
24 return redfish_requests.TelemetryService(redfish, metric_limit)
25
26
27@pytest.fixture(scope='function')
28def report_definitions(redfish):
29 report_definitions = redfish_requests.ReportDef(redfish)
30 print('Cleaning reports before test')
31 for report in report_definitions.get_collection():
32 report_definitions.delete_report(report)
33 yield report_definitions
34 print('Cleaning reports after test')
35 for report in report_definitions.get_collection():
36 report_definitions.delete_report(report)