Skip to content
Snippets Groups Projects
Select Git revision
  • de77be4fffd8edbb5a03e5822904ee70ab7e66bb
  • python3 default protected
  • feature/exabgp_support2
  • feature/exabgp_support2.bgpextcommunity
  • feature/exabgp_support2.django4.2
  • fix/existingcheck_honor_fragtype
  • feature/python3-authz_netmask
  • feature/authz_netmask
  • fix/wrong_ratelimit_stats
  • feature/requirements_version_update2024-01
  • feature/split_celery
  • feature/improved-warning-mails
  • fix/reenable_expireset_via_restapi
  • feature/admin_user_delete_with_owned_rule_reassigning1
  • feature/admin_user_delete_with_owned_rule_reassigning
  • feature/branded_doc
  • fix/forked_snmp_polling_worker_exit_issue
  • fix/false_user_activation_error
  • feature/exabgp_with_docker-compose
  • fix/prefix_overlap_handling
  • fix/js_security_issues-a
  • save1
  • rpm-1.5-7
  • working1
  • myv1.6
  • t12b1
  • v1.5_newnew2
  • merged_final
  • v1.5_newnew
  • startstop_old
  • myadd2
  • tomas3
  • merge_jra2t6_and_RESTAPI
  • mytomas2
  • mynew1
  • new_jra2t6
  • v1.5_final
  • fod16_ruleroutes-merged_old
  • merged_new
  • v1.6_new_old
  • v1.5_new_old_follower
41 results

beanstalkc.py

Blame
  • test_inventory.py 1.64 KiB
    import tempfile
    
    import responses
    
    from mapping_provider.backends import cache, inventory
    
    from .common import load_test_data
    
    
    @responses.activate
    def test_inventory_service_download():
        """
        tmp bogus test - just to have something
        """
    
        inventory_base_uri = 'https://dummy-hostname.dummy.domain'
        reporting_base_uri = 'https://another-dummy-hostname.dummy.domain'
    
        responses.add(
            method=responses.GET,
            url=f'{inventory_base_uri}/poller/interfaces',
            json=load_test_data('poller-interfaces.json')
        )
        responses.add(
            method=responses.GET,
            url=f'{reporting_base_uri}/scid/current',
            json=load_test_data('scid-current.json')
        )
        responses.add(
            method=responses.GET,
            url=f'{inventory_base_uri}/map/services',
            json=load_test_data('inprov-services.json')
        )
        
        with tempfile.TemporaryDirectory() as tmp_dir:
    
            cache.init(tmp_dir)
            inventory._load_all_inventory(
                inventory_base_uri='https://dummy-hostname.dummy.domain',
                reporting_base_uri='https://another-dummy-hostname.dummy.domain')
    
            # assert os.path.exists(os.path.join(tmp_dir, services.POLLER_INTERFACES_CACHE_FILENAME))
    
            cached_data = cache.get(inventory.INPROV_POLLER_INTERFACES_CACHE_FILENAME)
            assert cached_data == load_test_data('poller-interfaces.json')
    
            cached_data = cache.get(inventory.INPROV_MAP_SERVICES_CACHE_FILENAME)
            assert cached_data == load_test_data('inprov-services.json')
    
            cached_data = cache.get(inventory.REPORTING_SCID_CURRENT_CACHE_FILENAME)
            assert cached_data == load_test_data('scid-current.json')