def test_parse(self): for xml0 in [GET]: o = ofc.OFCapableSwitchType.from_xml(xml0) xml1 = o.to_xml('capable-switch') ok_( xml_compare(ET.fromstring(xml0), ET.fromstring(xml1), reporter=sys.stderr.write))
def test_poster_preview(self): """ Tests that the pressetext is an attachment """ response=self.client.get(reverse('vortraege_svg_poster', kwargs={'pk': 1})) self.assertEqual(response.status_code, 200) self.assertTrue(response['Content-Disposition'].startswith('attachment')) self.assertTrue(response['Content-Type'].startswith('image/svg+xml')) with file('test/vortraege_views_testdata_poster_1.svg') as expect_file: expected = etree.fromstring(expect_file.read()) actual = etree.fromstring(response.content) self.assertTrue(xml_compare(expected, actual, reporter=sys.stderr.write))
def assertXML(self, expected, actual): errors = [] xml_compare( expected, actual, reporter=errors.append, strip_whitespaces=True) if errors: raise AssertionError('\n'.join(errors))
def test_parse(self): for xml0 in [GET]: o = ofc.OFCapableSwitchType.from_xml(xml0) xml1 = o.to_xml('capable-switch') ok_(xml_compare(ET.fromstring(xml0), ET.fromstring(xml1), reporter=sys.stderr.write))