def test_list(self): api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=True) result = api.hostgroups.list() assert constants.Test_Hostgroup['name'] in result
def test_exists(self): api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=True) result = api.hostgroups.exists(constants.Test_Hostgroup['name']) assert result
def test_delete(self): api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=True) result = api.hostgroups.delete(constants.Test_Hostgroup['name']) assert result['results'][0]['code'] == 200
def test_objects(self): api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=True) result = api.hostgroups.objects() assert any( res.get('name', None) == constants.Test_Hostgroup['name'] for res in result)
def test_service_exists(): """ Testing if the service was added correctly """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.services.exists(constants.TestService_name) assert response
def test_host_delete(): """ Delete the created Host """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.hosts.delete(constants.TestHost_data['attrs']['name']) assert response != None
def test_host_list(): """ Listing all Hosts, and check if created host is present """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.hosts.list() assert constants.TestHost_data['attrs']['name'] in response
def test_host_exists(): """ Testing if the host was added correctly """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.hosts.exists(constants.TestHost_data['attrs']['name']) assert response
def test_service_objects(): """ Get all service Objects and check if created service is present """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.services.objects() assert any(result['attrs'].get('name', None) == constants.TestService_name for result in response)
def test_service_delete(): """ Delete the created service """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.services.delete( servicename=constants.TestService_name, hostname=constants.TestHost_data['attrs']['name']) assert response != None
def test_service_list(): """ Listing all services, and check if created service is present """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.services.list( hostname=constants.TestHost_data['attrs']['name']) assert constants.TestHost_data['attrs'][ 'name'] + "!" + constants.TestService_name in response.values()
def test_host_objects(): """ Get all Host Objects and check if created host is present """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.hosts.objects() assert any( res.get('name', None) == constants.TestHost_data['attrs']['name'] for res in response)
def test_host_add(): """ Testing the addition of a host """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) data = copy.deepcopy(constants.TestHost_data) response = api.hosts.add(data) assert response['results'][0]['code'] == 200
def test_service_add(): """ Testing the addition of a service """ api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=False) response = api.services.add( servicename=constants.TestService_name, hostname=constants.TestHost_data['attrs']['name'], data=constants.TestService_data) assert response['results'][0]['code'] == 200
def test_add(self): api = Icinga2API(username=constants.username, password=constants.password, url=constants.url, debug=True) result = api.usergroups.add(constants.Test_Usergroup) assert result['results'][0]['code'] == 200