From 214ce1a0bc3110a664df8298c4ecbf8f1959d1ea Mon Sep 17 00:00:00 2001 From: Ahmed AbouZaid Date: Sat, 16 Sep 2017 03:41:06 +0200 Subject: [PATCH] move config section to top --- netbox/tests/test_netbox.py | 74 ++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/netbox/tests/test_netbox.py b/netbox/tests/test_netbox.py index 93ed309..8326245 100644 --- a/netbox/tests/test_netbox.py +++ b/netbox/tests/test_netbox.py @@ -11,6 +11,43 @@ # Init. ############################################################################### +# Netbox config file. +netbox_config = ''' +netbox: + main: + api_url: 'http://localhost/api/dcim/devices/' + + # How servers will be grouped. + # If no group specified here, inventory script will return all servers. + group_by: + # Default section in Netbox. + default: + - device_role + - rack + - platform + # Custom sections (custom_fields) could be used. + #custom: + # - env + + # Use Netbox sections as host variables. + hosts_vars: + # Sections related to IPs e.g. "primary_ip" or "primary_ip4". + ip: + ansible_ssh_host: primary_ip + # Any other sections. + general: + rack_name: rack + # Custom sections (custom_fields) could be used as vars too. + #custom: + # env: env +''' + +# Mock open Netbox config file. +netbox_config_file = tempfile.NamedTemporaryFile(delete=False, mode='a') +netbox_config_file.write(netbox_config) +netbox_config_file.close() +netbox_config_data = yaml.load(netbox_config) + # Fake Netbox api output. netbox_api_output = json.loads(''' [ @@ -172,43 +209,6 @@ } ''') -# Netbox config file. -netbox_config = ''' -netbox: - main: - api_url: 'http://localhost/api/dcim/devices/' - - # How servers will be grouped. - # If no group specified here, inventory script will return all servers. - group_by: - # Default section in Netbox. - default: - - device_role - - rack - - platform - # Custom sections (custom_fields) could be used. - #custom: - # - env - - # Use Netbox sections as host variables. - hosts_vars: - # Sections related to IPs e.g. "primary_ip" or "primary_ip4". - ip: - ansible_ssh_host: primary_ip - # Any other sections. - general: - rack_name: rack - # Custom sections (custom_fields) could be used as vars too. - #custom: - # env: env -''' - -# Mock open Netbox config file. -netbox_config_file = tempfile.NamedTemporaryFile(delete=False, mode='a') -netbox_config_file.write(netbox_config) -netbox_config_file.close() -netbox_config_data = yaml.load(netbox_config) - # Common vars. netbox_api_output_json = json.dumps(netbox_api_output) fake_host_json = json.dumps(fake_host)