def testUstadMobileExport(self):
     # Load a package
     filePath = self.inFilePath
     
     package = Package.load(filePath)
     self.assertIsNotNone(package, "Failed to load package")
     
     
     #test the tincan.xml generation
     desc_text = "Description Test"
     package.set_description(desc_text)
     
     self.assertEqual(desc_text, package.get_tincan_description(), 
                      "Description set and picked up")
     
     #test description will be title when description is blank
     package.set_description("")
     self.assertEqual(package.get_tincan_title(), 
                  package.get_tincan_description(),
                  "Description blank, tincan desc = title")
     
     
     
     
     styles_dir = G.application.config.stylesDir / package.style
     xmlExport = XMLExport(G.application.config, styles_dir,
                           self.epubOutPath)
     
     
     xmlExport.export(package)
     
     
     
     self.extract_dir = TempDirPath()
     zip_file = ZipFile(self.epubOutPath)
     zip_file.extractall(self.extract_dir)
     
     outdir = self.extract_dir/"EPUB"
     
     
     #test that we can force it to have a title and identifier
     missing_metadata_dict = {"title" : "", "identifier" : ""}
     
     cover = xmlExport.make_cover_page(package)
     self.assertIsNotNone(cover, "Can create cover for package")
     publication= xmlExport.make_publication_epub3(outdir, package, cover)
     self.assertIsNotNone(publication, "Can create publication object")
     
     
     fixed_metadata = publication.check_metadata_for_epub(
                        missing_metadata_dict, package)
     self.assertTrue(len(fixed_metadata['title']) > 0, 
                     "Title Added")
     
     self.assertEqual(fixed_metadata['identifier'],
                      package.dublinCore.identifier,
                      "Identifier added from dublin core")
     
     
     
     #check that the modification time on our resource files 
     #are as per original so they can be easily cached
     xml_copy_list = xmlExport.make_xml_copy_list(package, outdir) 
     TestUtils.check_copy_list_mod_time(xml_copy_list,self)
     
     
     mainFolder = Path(self.extract_dir/"EPUB")
     assert mainFolder.exists()
     
     exeTocPath = Path(mainFolder / "exetoc.xml")
     
     
     #check the tincan.xml
     tincan_etree_doc = ElementTree.parse(
                      self.extract_dir/"tincan.xml")
     namespaces = {"tincan" : 
                         "http://projecttincan.com/tincan.xsd"}
     tincan_etree = tincan_etree_doc.getroot()
     
     
     launch_el_arr = tincan_etree.findall(
                      "tincan:activities/tincan:activity/tincan:launch",
                      namespaces)
     self.assertEqual(len(launch_el_arr), 1, 
                      "1 activity with launch")
     self.assertEqual(
         tincan_etree.find(
             "tincan:activities/tincan:activity[0]/tincan:name", 
             namespaces).text,
         package.get_tincan_title())
     
     self.assertEqual(
         tincan_etree.find(
            "tincan:activities/tincan:activity[0]/tincan:description",
            namespaces).text,
         package.get_tincan_description(),
         "Description serialized matchese tincan desc")
     
     
     str = exeTocPath.open().read()
     from xml.dom.minidom import parse, parseString
     dom = parseString(str)
     self.assertIsNotNone(dom, "Did not parse exetoc.xml it seems")
     self.assertEqual(dom.documentElement.tagName, "exebase", "exebase is not the tag")
     audioFormatList = dom.documentElement.getAttribute("audioformats")
     videoFormatList = dom.documentElement.getAttribute("videoformats")
     resolutionList = dom.documentElement.getAttribute("resolutions")
     
     
     pageNodeList = dom.getElementsByTagName("page")
     for page in pageNodeList:
         href = page.getAttribute("href")
         pagePath = Path(mainFolder / href)
         self.assertTrue(pagePath.exists(), "FAILED: " + href + " does not exist")
         
         pageString = pagePath.open().read()
         pageDOM = parseString(pageString)
         self.assertIsNotNone(pageDOM, "Failed to read " + href + " into DOM") 
         
         ideviceListFromToc = page.getElementsByTagName("idevice")
         for ideviceEl in ideviceListFromToc:
             # look for the idevice in the DOM list of the page
             foundDeviceInPage = False
             foundIdeviceInPageEl = None
             ideviceIdFromToc = ideviceEl.getAttribute("id")
             
             ideviceListFromPage = pageDOM.getElementsByTagName("idevice")
             for ideviceElFromPage in ideviceListFromPage:
                 if ideviceElFromPage.getAttribute("id") == ideviceIdFromToc:
                     foundDeviceInPage = True
                     foundIdeviceInPageEl = ideviceElFromPage
             
             self.assertTrue(foundDeviceInPage, "idevice id " \
                              + ideviceIdFromToc + " was not in page " + href)
         
         # procedure to check media slide
         if foundIdeviceInPageEl.getAttribute("type") == "mediaslide":
             #self.doCheckMediaSlide(foundIdeviceInPageEl, href, mainFolder, package, dom.documentElement)
             pass
     
     pass