def test_other_closing_tag(self): context = OtherXMLFileContext(self.metadata_file_dir, 0) context._open_metadata_file_handle() self.assertRaises(NotImplementedError, context._write_root_tag_close) context._write_root_tag_open() try: context._write_root_tag_close() except Exception, e: self.fail(e.message)
def test_other_opening_tag(self): path = os.path.join(self.metadata_file_dir, REPO_DATA_DIR_NAME, OTHER_XML_FILE_NAME) context = OtherXMLFileContext(self.metadata_file_dir, 0) context._open_metadata_file_handle() context._write_root_tag_open() context._close_metadata_file_handle() self.assertNotEqual(os.path.getsize(path), 0) other_handle = gzip.open(path, "r") context = other_handle.read() other_handle.close() self.assertTrue(context.startswith("<otherdata")) self.assertEqual(context.count('xmlns="%s"' % OTHER_NAMESPACE), 1) self.assertEqual(context.count('packages="0"'), 1)