• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python restconf.load_multiple_schema_root函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中rift.restconf.load_multiple_schema_root函数的典型用法代码示例。如果您正苦于以下问题:Python load_multiple_schema_root函数的具体用法?Python load_multiple_schema_root怎么用?Python load_multiple_schema_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load_multiple_schema_root函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_conversion_XML_to_JSON_get_list_with_name_of_child

    def test_conversion_XML_to_JSON_get_list_with_name_of_child(self):
        self.maxDiff = None
        url = "/api/config/car/toyota/models/name-m"
        xml = _collapse_string('''
        <data>
          <car xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">
            <brand>toyota</brand>
            <models>
              <name-m>name-m</name-m>    
              <capacity>5</capacity>     
            </models>
          </car>
        </data>
        ''')
        #

        expected_json = _collapse_string('''
{"vehicle-a:models" :{"name-m" : "name-m","capacity" : 5}}
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        converter = XmlToJsonTranslator(schema, logger)

        xpath = create_xpath_from_url(url, schema)
        
        actual_json = converter.convert(False, url, xpath, xml)

        actual = _ordered(json.loads(actual_json))
        expected = _ordered(json.loads(expected_json))

        self.assertEquals(actual, expected)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:32,代码来源:test_rest.py


示例2: test_json_body_2

    def test_json_body_2(self):
        self.maxDiff = None
        url = "/api/config/multi-key"
        body = _collapse_string('''
{
  "multi-key" :
  [
    {
      "foo" : "key part 1",
      "bar" : "key part 2",
      "treasure" : "some string"
    },
    {
      "foo" : "other key part 1",
      "bar" : "other key part 2",
      "treasure" : "some other string"
    }
  ]
}
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><multi-key xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><foo xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">key part 1</foo><bar xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">key part 2</bar><treasure xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">some string</treasure></multi-key><multi-key xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><foo xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">other key part 1</foo><bar xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">other key part 2</bar><treasure xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">some other string</treasure></multi-key></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:32,代码来源:test_rest_put.py


示例3: test_xml_body_3

    def test_xml_body_3(self):
        self.maxDiff = None
        url = "/api/config/top-list-deep"
        body = _collapse_string('''
<top-list-deep>
  <k>some key<k>
  <inner-list>
    <k>some other key</k?
    <a>some string</a>
    <inner-container>
      <a>some other string</a>
    </inner-container>      
  </inner-list>
  <inner-container-shallow>
    <a>yet a third string</a>
  </inner-container-shallow>    
  <inner-container-deep>
    <bottom-list-shallow>
      <k>yet a third key</a>
    </bottom-list-shallow>
  </inner-container-deep>    
</top-list-deep>
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><top-list-deep xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><k>some key<k><inner-list><k>some other key</k?<a>some string</a><inner-container><a>some other string</a></inner-container></inner-list><inner-container-shallow><a>yet a third string</a></inner-container-shallow><inner-container-deep><bottom-list-shallow><k>yet a third key</a></bottom-list-shallow></inner-container-deep></top-list-deep></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"xml"))

        self.assertEqual(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:35,代码来源:test_rest_put.py


示例4: test_json_body_1

    def test_json_body_1(self):
        self.maxDiff = None
        url = "/api/config/top-list-shallow/"
        body = _collapse_string('''
{
  "top-list-shallow"  :
  [
    {
      "k" : "some key 1"
    },
    {
      "k" : "some key 2"
    }

  ]
}

        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><top-list-shallow xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><k xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">some key 1</k></top-list-shallow><top-list-shallow xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><k xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">some key 2</k></top-list-shallow></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:30,代码来源:test_rest_put.py


示例5: test_conversion_XML_to_JSON_version

    def test_conversion_XML_to_JSON_version(self):
        self.maxDiff = None
        url = "/api/config/car/toyota/models"
        xml = _collapse_string('''
<data>
          <car xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">
            <models>
              <name-m>Camry</name-m>	  
              <year>2015</year>	  
              <capacity>5</capacity>	  
              <version_str>2.0</version_str>
            </models>
          </car>
        </data>
        ''')
        #

        expected_json = _collapse_string('''
{"vehicle-a:models":[{"year" : 2015,"name-m" : "Camry","capacity" : 5, "version_str":"2.0"}]}
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        converter = XmlToJsonTranslator(schema, logger)

        xpath = create_xpath_from_url(url, schema)
        
        actual_json = converter.convert(False, url, xpath, xml)

        actual = _ordered(json.loads(actual_json))
        expected = _ordered(json.loads(expected_json))

        self.assertEquals(actual, expected)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:33,代码来源:test_rest.py


示例6: test_json_body_8

    def test_json_body_8(self):
        self.maxDiff = None
        url = "/api/config/top-container-deep/inner-container"
        body = _collapse_string('''
{
    "a":"another string",
    "inner-list":[
        {
            "k":"another key thing"
        }
    ]
}
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><top-container-deep xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><vehicle-a:inner-container xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><a xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">another string</a><inner-list xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><k xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">another key thing</k></inner-list></vehicle-a:inner-container></top-container-deep></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:25,代码来源:test_rest_put.py


示例7: test_json_body_11

    def test_json_body_11(self):
        self.maxDiff = None
        url = "/api/config/misc"
        body = _collapse_string('''
{
    "bool-leaf":true,
    "empty-leaf":[null],
    "enum-leaf":"a",
    "int-leaf":42,
    "list-a":[
        {
            "id":0,
            "foo":"asdf"
        }
    ],
    "list-b":[
        {
            "id":0
        }
    ],
    "numbers":[
        {
            "int8-leaf":0,
            "int16-leaf":0,
            "int32-leaf":0,
            "int64-leaf":0,
            "uint8-leaf":0,
            "uint16-leaf":0,
            "uint32-leaf":0,
            "uint64-leaf":0,
            "decimal-leaf":0
        },
        {
            "int8-leaf":"1",
            "int16-leaf":"0",
            "int32-leaf":"0",
            "int64-leaf":"0",
            "uint8-leaf":"0",
            "uint16-leaf":"0",
            "uint32-leaf":"0",
            "uint64-leaf":"0",
            "decimal-leaf":"0"
        }
    ]
}
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><vehicle-a:misc xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><bool-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">true</bool-leaf><empty-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"></empty-leaf><enum-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">a</enum-leaf><int-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">42</int-leaf><list-a xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><id xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</id><foo xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">asdf</foo></list-a><list-b xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><id xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</id></list-b><numbers xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><int8-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int8-leaf><int16-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int16-leaf><int32-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int32-leaf><int64-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int64-leaf><uint8-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint8-leaf><uint16-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint16-leaf><uint32-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint32-leaf><uint64-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint64-leaf><decimal-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</decimal-leaf></numbers><numbers xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><int8-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">1</int8-leaf><int16-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int16-leaf><int32-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int32-leaf><int64-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</int64-leaf><uint8-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint8-leaf><uint16-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint16-leaf><uint32-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint32-leaf><uint64-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</uint64-leaf><decimal-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</decimal-leaf></numbers></vehicle-a:misc></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:58,代码来源:test_rest_put.py


示例8: test_conversion_CONFD_URL_to_XML_get_list_key

    def test_conversion_CONFD_URL_to_XML_get_list_key(self):
        self.maxDiff = None # expected_xml is too large

        url = "/api/operational/car/honda"
        expected_xml = _collapse_string('''
<data><vehicle-a:car xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><brand>honda</brand></vehicle-a:car></data>
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        actual_xml = convert_get_request_to_xml(schema, url) 

        self.assertEquals(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:13,代码来源:test_rest.py


示例9: test_conversion_CONFD_URL_to_XML_delete_list_key

    def test_conversion_CONFD_URL_to_XML_delete_list_key(self):
        self.maxDiff = None # expected_xml is too large

        url = "/api/operational/top-container-deep/inner-container/inner-list/some-key"
        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><top-container-deep xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><inner-container xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><inner-list xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="delete"><k>some-key</k></inner-list></inner-container></top-container-deep></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("DELETE", url, None)

        self.assertEquals(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:15,代码来源:test_rest.py


示例10: test_conversion_CONFD_URL_to_XML_00

    def test_conversion_CONFD_URL_to_XML_00(self):
        self.maxDiff = None # expected_xml is too large

        url = "/api/config/top-container-deep"
        expected_xml = _collapse_string('''
<data>
  <vehicle-a:top-container-deep xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"/>
</data>
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        actual_xml = convert_get_request_to_xml(schema, url)

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:15,代码来源:test_rest_get.py


示例11: test_get_cross_namespace

    def test_get_cross_namespace(self):
        self.maxDiff = None # expected_xml is too large

        url = "/api/config/car/honda%20motors/extras"
        expected_xml = _collapse_string('''
<data>
  <vehicle-a:car xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">
    <brand>honda motors</brand>
    <vehicle-augment-a:extras xmlns:vehicle-augment-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-augment-a"/>
  </vehicle-a:car>
</data>
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        actual_xml = convert_get_request_to_xml(schema, url)

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:18,代码来源:test_rest_get.py


示例12: test_conversion_CONFD_URL_to_XML_delete_list_key_simple

    def test_conversion_CONFD_URL_to_XML_delete_list_key_simple(self):
        self.maxDiff = None # expected_xml is too large

        url = "/api/operational/car/honda"
        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <car xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="delete">
    <brand>honda</brand>
  </car>
</config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("DELETE", url, None)

        self.assertEquals(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:19,代码来源:test_rest.py


示例13: test_conversion_CONFD_URL_to_XML_25

    def test_conversion_CONFD_URL_to_XML_25(self):
        self.maxDiff = None # expected_xml is too large

        url = "/api/config/multi-key/firstkey,secondkey/treasure"
        expected_xml = _collapse_string('''
<data>
  <vehicle-a:multi-key xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">
    <foo>firstkey</foo>
    <bar>secondkey</bar>
    <vehicle-a:treasure/>
  </vehicle-a:multi-key>
</data>
        ''')

        schema = load_multiple_schema_root(["vehicle-a","vehicle-augment-a"])

        actual_xml = convert_get_request_to_xml(schema, url)

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:19,代码来源:test_rest_get.py


示例14: test_xml_body_4

    def test_xml_body_4(self):
        self.maxDiff = None
        url = "/api/config/top-list-deep/key1/inner-list/key2"
        body = _collapse_string('''
<inner-list>
  <k>key2</k>
</inner-list>
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><top-list-deep xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><k>key1</k><inner-list xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><k>key2</k></inner-list></top-list-deep></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"xml"))

        self.assertEqual(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:20,代码来源:test_rest_put.py


示例15: test_json_body_0

    def test_json_body_0(self):
        self.maxDiff = None
        url = "/api/config/top-container-shallow"
        body = _collapse_string('''
{
  "a" : "some leaf 0"
}
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><vehicle-a:top-container-shallow xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><a xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">some leaf 0</a></vehicle-a:top-container-shallow></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:20,代码来源:test_rest_put.py


示例16: test_xml_body_0

    def test_xml_body_0(self):
        self.maxDiff = None
        url = "/api/config/top-container-shallow"
        body = _collapse_string('''
<top-container-shallow>
  <a>some leaf 0</a>
</top-container-shallow>
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><top-container-shallow xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><a>some leaf 0</a></top-container-shallow></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"xml"))
        
        self.assertEqual(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:20,代码来源:test_rest_put.py


示例17: test_json_body_serialized_list_element

    def test_json_body_serialized_list_element(self):
        self.maxDiff = None
        url = "/api/config/misc/list-a/0"
        model = RwYang.model_create_libncx()
        model.load_schema_ypbc(VehicleAYang.get_schema())
        list_a_msg = VehicleAYang.YangData_VehicleA_Misc_ListA(id=0, foo="asdf")
        list_a_json = list_a_msg.to_json(model)
        body = _collapse_string(list_a_json)

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><misc xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><list-a xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a" xc:operation="replace"><id xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">0</id><foo xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a">asdf</foo></list-a></misc></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body, "json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:20,代码来源:test_rest_put.py


示例18: test_json_body_10

    def test_json_body_10(self):
        self.maxDiff = None
        url = "/api/config/misc"
        body = _collapse_string('''
{
        "empty-leaf" : [null]
}
        ''')

        expected_xml = _collapse_string('''
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"><vehicle-a:misc xmlns:vehicle-a="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"><empty-leaf xmlns="http://riftio.com/ns/core/mgmt/rwrestconf/test/vehicle-a"></empty-leaf></vehicle-a:misc></config>
        ''')

        schema = load_multiple_schema_root(["vehicle-a"])

        converter = ConfdRestTranslator(schema)

        actual_xml = converter.convert("PUT", url, (body,"json"))

        self.compare_doms(actual_xml, expected_xml)
开发者ID:gonotes,项目名称:RIFT.ware,代码行数:20,代码来源:test_rest_put.py



注:本文中的rift.restconf.load_multiple_schema_root函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python restconf.ConfdRestTranslator类代码示例发布时间:2022-05-26
下一篇:
Python restconf.convert_get_request_to_xml函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap