def test20_parse_document(self): # Key property of the parse_document() method is that it parses the # document and identifies its type c = Client() with capture_stdout() as capturer: c.sitemap_name='tests/testdata/examples_from_spec/resourcesync_ex_1.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcelist document with 2 entries',capturer.result) ) with capture_stdout() as capturer: c.sitemap_name='tests/testdata/examples_from_spec/resourcesync_ex_17.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcedump document with 3 entries',capturer.result) ) with capture_stdout() as capturer: c.sitemap_name='tests/testdata/examples_from_spec/resourcesync_ex_19.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changelist document with 4 entries',capturer.result) ) with capture_stdout() as capturer: c.sitemap_name='tests/testdata/examples_from_spec/resourcesync_ex_22.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changedump document with 3 entries',capturer.result) ) # Document that doesn't exist c.sitemap_name='/does_not_exist' self.assertRaises( ClientFatalError, c.parse_document ) # and verbose with truncation... with capture_stdout() as capturer: c.verbose = True c.sitemap_name = 'tests/testdata/examples_from_spec/resourcesync_ex_1.xml' c.max_sitemap_entries = 1 c.parse_document() self.assertTrue( re.search(r'Showing first 1 entries', capturer.result ) ) self.assertTrue( re.search(r'\[0\] ', capturer.result ) ) self.assertFalse( re.search(r'\[1\] ', capturer.result ) )
def test20_parse_document(self): # Key property of the parse_document() method is that it parses the # document and identifies its type c = Client() with capture_stdout() as capturer: c.sitemap_name = 'resync/test/testdata/examples_from_spec/resourcesync_ex_1.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcelist document with 2 entries', capturer.result)) with capture_stdout() as capturer: c.sitemap_name = 'resync/test/testdata/examples_from_spec/resourcesync_ex_17.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcedump document with 3 entries', capturer.result)) with capture_stdout() as capturer: c.sitemap_name = 'resync/test/testdata/examples_from_spec/resourcesync_ex_19.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changelist document with 4 entries', capturer.result)) with capture_stdout() as capturer: c.sitemap_name = 'resync/test/testdata/examples_from_spec/resourcesync_ex_22.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changedump document with 3 entries', capturer.result))
def test20_parse_document(self): # Key property of the parse_document() method is that it parses the # document and identifies its type c = Client() with capture_stdout() as capturer: c.sitemap_name = 'tests/testdata/examples_from_spec/resourcesync_ex_1.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcelist document with 2 entries', capturer.result)) with capture_stdout() as capturer: c.sitemap_name = 'tests/testdata/examples_from_spec/resourcesync_ex_17.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcedump document with 3 entries', capturer.result)) with capture_stdout() as capturer: c.sitemap_name = 'tests/testdata/examples_from_spec/resourcesync_ex_19.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changelist document with 4 entries', capturer.result)) with capture_stdout() as capturer: c.sitemap_name = 'tests/testdata/examples_from_spec/resourcesync_ex_22.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changedump document with 3 entries', capturer.result)) # Document that doesn't exist c.sitemap_name = '/does_not_exist' self.assertRaises(ClientFatalError, c.parse_document) # and verbose with truncation... with capture_stdout() as capturer: c.verbose = True c.sitemap_name = 'tests/testdata/examples_from_spec/resourcesync_ex_1.xml' c.max_sitemap_entries = 1 c.parse_document() self.assertTrue(re.search(r'Showing first 1 entries', capturer.result)) self.assertTrue(re.search(r'\[0\] ', capturer.result)) self.assertFalse(re.search(r'\[1\] ', capturer.result))
def test20_parse_document(self): # Key property of the parse_document() method is that it parses the # document and identifies its type c = Client() with capture_stdout() as capturer: c.sitemap_name='resync/test/testdata/examples_from_spec/resourcesync_ex_1.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcelist document with 2 entries',capturer.result) ) with capture_stdout() as capturer: c.sitemap_name='resync/test/testdata/examples_from_spec/resourcesync_ex_17.xml' c.parse_document() self.assertTrue( re.search(r'Parsed resourcedump document with 3 entries',capturer.result) ) with capture_stdout() as capturer: c.sitemap_name='resync/test/testdata/examples_from_spec/resourcesync_ex_19.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changelist document with 4 entries',capturer.result) ) with capture_stdout() as capturer: c.sitemap_name='resync/test/testdata/examples_from_spec/resourcesync_ex_22.xml' c.parse_document() self.assertTrue( re.search(r'Parsed changedump document with 3 entries',capturer.result) )