示例#1
0
文件: lxc_test.py 项目: noxdafox/see
 def test_domain_xml_filesystem(self):
     """LXC XML with filesystem."""
     config = """<domain></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices><filesystem type="mount">""" +\
                """<source dir="foo" /><target dir="bar" /></filesystem></devices></domain>"""
     results = lxc.domain_xml('foo', config, [('foo', 'bar')])
     self.assertEqual(results, expected, compare(results, expected))
示例#2
0
文件: lxc_test.py 项目: MahaKoala/see
 def test_domain_xml_modifies(self):
     """Fields are modified if existing."""
     config = """<domain><name>bar</name><uuid>bar</uuid></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices><filesystem type="mount">""" +\
                """<source dir="foo" /><target dir="bar" /></filesystem></devices></domain>"""
     results = lxc.domain_xml('foo', config, [('foo', 'bar')])
     self.assertEqual(results, expected, compare(results, expected))
示例#3
0
文件: lxc_test.py 项目: zdzhjx/see
 def test_domain_xml_modifies(self):
     """Fields are modified if existing."""
     config = """<domain><name>bar</name><uuid>bar</uuid></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices><filesystem type="mount">""" +\
                """<source dir="foo" /><target dir="bar" /></filesystem></devices></domain>"""
     results = lxc.domain_xml('foo', config, [('foo', 'bar')])
     self.assertEqual(results, expected, compare(results, expected))
示例#4
0
文件: lxc_test.py 项目: xx-zhang/see
 def test_domain_xml_filesystem(self):
     """LXC XML with filesystem."""
     config = """<domain></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices><filesystem type="mount">""" +\
                """<source dir="foo" /><target dir="bar" /></filesystem></devices></domain>"""
     results = lxc.domain_xml('foo', config, [('foo', 'bar')])
     self.assertEqual(results, expected, compare(results, expected))
示例#5
0
文件: lxc_test.py 项目: MahaKoala/see
 def test_domain_xml_network(self):
     """XML with network fields are modified if existing."""
     config = """<domain></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices><filesystem type="mount">""" +\
                """<source dir="foo" /><target dir="bar" /></filesystem><interface type="network">""" +\
                """<source network="foo" /></interface></devices></domain>"""
     results = lxc.domain_xml('foo', config, [('foo', 'bar')], network_name='foo')
     self.assertEqual(results, expected, compare(results, expected))
示例#6
0
文件: lxc_test.py 项目: zdzhjx/see
 def test_domain_xml_network(self):
     """XML with network fields are modified if existing."""
     config = """<domain></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices><filesystem type="mount">""" +\
                """<source dir="foo" /><target dir="bar" /></filesystem><interface type="network">""" +\
                """<source network="foo" /></interface></devices></domain>"""
     results = lxc.domain_xml('foo',
                              config, [('foo', 'bar')],
                              network_name='foo')
     self.assertEqual(results, expected, compare(results, expected))
示例#7
0
文件: lxc_test.py 项目: MahaKoala/see
 def test_domain_xml(self):
     """XML with no network and no filesystem."""
     config = """<domain></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices /></domain>"""
     results = lxc.domain_xml('foo', config, [])
     self.assertEqual(results, expected, compare(results, expected))
示例#8
0
文件: lxc_test.py 项目: zdzhjx/see
 def test_domain_xml(self):
     """XML with no network and no filesystem."""
     config = """<domain></domain>"""
     expected = """<domain><name>foo</name><uuid>foo</uuid><devices /></domain>"""
     results = lxc.domain_xml('foo', config, [])
     self.assertEqual(results, expected, compare(results, expected))