Beispiel #1
0
    def devices(self):
        """
        Get data from cmdb
        """

        headers = {'useragent': self.useragent}

        res = requests.get(self.__endpoint(
            'devices?embedded={"ip_addresses":1,"site.name":1}'),
                           headers=headers)

        return res.json()['_items']
Beispiel #2
0
    def devices(self):
        """
        Get data from cmdb
        """

        headers = {
            'useragent': self.useragent
        }

        res = requests.get(
            self.__endpoint('devices?embedded={"ip_addresses":1,"site.name":1}'),
            headers=headers)

        return res.json()['_items']
def test_getting_getting_a_service():
    c = consul.Consul()
    c.agent.service.register('httpd', port=80)
    response = requests_srv.get('http://_httpd._tcp.service.consul/index.html')
    assert response.status_code == 200
def test_unknown_domain():
    with pytest.raises(requests.ConnectionError) as excinfo:
        response = requests_srv.get('http://_foobar._tcp.service.consul/index.html')
    assert 'DNS error: NXDOMAIN' in excinfo.value
Beispiel #5
0
def test_getting_getting_a_service():
    c = consul.Consul()
    c.agent.service.register('httpd', port=80)
    response = requests_srv.get('http://_httpd._tcp.service.consul/index.html')
    assert response.status_code == 200
Beispiel #6
0
def test_unknown_domain():
    with pytest.raises(requests.ConnectionError) as excinfo:
        response = requests_srv.get(
            'http://_foobar._tcp.service.consul/index.html')
    assert 'DNS error: NXDOMAIN' in excinfo.value