Coverage for tests/test_apiclient.py: 100%
25 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-25 05:47 +0000
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-25 05:47 +0000
1import pytest
2from zenossapi import apiclient as zapi
3from zenossapi.routers.events import EventsRouter
5host = 'https://zenoss'
6user = 'admin'
7password = 'zenoss'
8collection_zone = 'cz1'
9api_key = 'a594730e-293c-4d32-915e-edf43aa9bae8'
12class TestZenossClient(object):
14 def test_client_init(self):
15 zc = zapi.Client(host=host, user=user, password=password)
16 assert zc.api_url == '{0}/zport/dmd'.format(host)
17 assert 'authorization' in zc.api_headers
18 assert zc.ssl_verify
20 zc = zapi.Client(host=host, collection_zone=collection_zone, api_key=api_key)
21 assert zc.api_url == '{0}/{1}/zport/dmd'.format(host, collection_zone)
22 assert 'z-api-key' in zc.api_headers
23 assert zc.ssl_verify
25 def test_client_get_routers(self):
26 zc = zapi.Client(host=host, user=user, password=password)
27 zc.get_routers()
29 def test_client_get_router(self):
30 zc = zapi.Client(host=host, user=user, password=password)
31 device_router = zc.get_router('events')
32 assert isinstance(device_router, EventsRouter)