示例#1
0
 def test_open_yaml_file_not_exists(self, yaml_file):
     """
     Test open non-exists yaml file.
     """
     with pytest.raises(SystemExit) as file_not_exists:
         netbox.open_yaml_file(yaml_file)
     assert file_not_exists
示例#2
0
 def test_open_yaml_file_invalid(self, yaml_file):
     """
     Test open invalid yaml file.
     """
     with pytest.raises(SystemExit) as invalid_yaml_syntax:
         with patch(builtin_open,
                    new_callable=mock_open,
                    read_data=netbox_config_invalid):
             netbox.open_yaml_file(yaml_file)
     assert invalid_yaml_syntax
示例#3
0
 def test_open_yaml_file_exists(self, yaml_file):
     """
     Test open exists yaml file.
     """
     with patch(builtin_open,
                new_callable=mock_open,
                read_data=netbox_config):
         config_output = netbox.open_yaml_file(yaml_file)
         assert config_output["netbox"]
         assert config_output["netbox"]["main"]["api_url"]