def test_string_dat_valid_xml(self):
     """Tests RHM._string_data() with a valid XML object."""
     a = ElementTree.Element("a")
     b = ElementTree.Element("b")
     b.text = "hey"
     a.append(b)
     res = rhm._string_data(a, 'xml')
     self.assertEqual("<a><b>hey</b></a>", res)
Beispiel #2
0
 def test_string_dat_valid_xml(self):
     """Tests RHM._string_data() with a valid XML object."""
     a = ElementTree.Element("a")
     b = ElementTree.Element("b")
     b.text = "hey"
     a.append(b)
     res = rhm._string_data(a)
     self.assertEqual("<a><b>hey</b></a>", res)
 def test_string_dat_valid_xml_w_attrs(self):
     """Tests RHM._string_data() with a valid XML object."""
     a = ElementTree.Element("a")
     a.attrib = {"key": "val"}
     b = ElementTree.Element("b")
     b.text = "hey"
     a.append(b)
     res = rhm._string_data(a, 'xml')
     self.assertEqual('<a key="val"><b>hey</b></a>', res)
Beispiel #4
0
 def test_string_dat_valid_xml_w_attrs(self):
     """Tests RHM._string_data() with a valid XML object."""
     a = ElementTree.Element("a")
     a.attrib = {"key": "val"}
     b = ElementTree.Element("b")
     b.text = "hey"
     a.append(b)
     res = rhm._string_data(a)
     self.assertEqual('<a key="val"><b>hey</b></a>', res)
 def test_string_dat_valid_dict(self):
     """Tests RHM._string_data() with a valid dict."""
     _dict = {"a": "val", "b": "val2"}
     res = rhm._string_data(_dict, 'json')
     j_dat = json.loads(res)
     self.assertEqual(_dict, j_dat)
Beispiel #6
0
 def test_string_dat_valid_dict(self):
     """Tests RHM._string_data() with a valid dict."""
     _dict = {"a": "val", "b": "val2"}
     res = rhm._string_data(_dict)
     j_dat = json.loads(res)
     self.assertEqual(_dict, j_dat)