Skip to content
Snippets Groups Projects
test_junos_devices_query.py 687 B
import os

import responses

import inventory_provider
from inventory_provider import juniper

TEST_DATA_FILENAME = os.path.realpath(os.path.join(
    inventory_provider.__path__[0],
    '..',
    'test',
    'data',
    'netdash-alldevices.txt'))


@responses.activate
def test_junosspace_devices_parsing(data_config):
    data_config['managed-routers'] = 'http://sabababa'
    with open(TEST_DATA_FILENAME) as f:
        responses.add(
            method=responses.GET,
            url=data_config['managed-routers'],
            body=f.read())

    hostnames = juniper.load_routers_from_netdash(
        data_config['managed-routers'])

    assert 'mx1.ams.nl.geant.net' in hostnames