def test_properties_asset_extract(self, tmpdir):
     newname = random_string()
     m = GetAsset('MVProps/content.xml')
     assert m is not None
     m.extract(save_name=newname)
     for filename in 'content.xml', 'properties.xml':
         file_exists = os.path.join(newname, filename)
         assert os.path.exists(file_exists), f'{file_exists} does not exist'
 def test_macro_extract_git_sha_remove(self, tmpdir):
     macroname = random_string()
     m = GetAsset('macro/MVMacro1')
     assert m is not None
     m.root.label = objectify.StringElement(macroname)
     m.assemble(save_name=macroname)
     m = GetAsset(macroname + '.' + tagset.macro.ext)
     assert m is not None
     assert m.is_macro
     m.extract()
     assert os.path.exists(f'macro/{macroname}.xml'), f'expected macro/{macroname}.xml in {glob("**/*")=}'
     assert os.path.exists(f'macro/{macroname}.command'), f'{glob("**/*")=}'
Beispiel #3
0
 def test_token_extract_sha_gmname_remove(self, tmpdir):
     tokenname = 'Lib:' + random_string()
     tokennameq = tokenname.replace(':', '-')
     m = GetAsset('MVToken')
     assert m is not None
     m.assemble(save_name=tokennameq)
     m = GetAsset(tokennameq + '.' + tagset.token.ext)
     assert m is not None
     m.extract()
     assert os.path.exists(tokennameq)
     assert os.path.isdir(tokennameq)
     assert os.path.exists(os.path.join(tokennameq, 'content.xml'))
     xml = objectify.parse(os.path.join(tokennameq, 'content.xml'))
     assert 'gmName' not in [x.tag for x in xml.getroot().iterchildren()]
Beispiel #4
0
 def test_asset_token_extract_with_name(self, tmpdir):
     tdir = 'MVToken'
     tfilename = tdir + '.rptok'
     target = 'NewMVToken'
     targetAsset = GetAsset(tdir)
     targetAsset.assemble()
     assert os.path.exists(tfilename), f'{tfilename} does not exist'
     m = GetAsset(tfilename)
     # assert False, m.save_to(None, target)
     assert m is not None
     assert m.fromdir is not None
     assert m.xmlfile is not None  # should this be None?
     assert m.zipfile is not None
     m.extract(save_name=target)
     for asset in 'properties.xml', 'content.xml', 'thumbnail', 'thumbnail_large', '1d20.command', '1d20.xml':
         assert os.path.exists(os.path.join(target, asset))
 def test_token_extract(self, token_file, tmpdir):
     tokfile = os.path.join(self.origdir, token_file)
     tokname = os.path.basename(os.path.splitext(token_file)[0])
     assert os.path.exists(tokfile), f'{tokfile} does not exist'
     tok = GetAsset(tokfile)
     assert tok is not None
     tok.extract()
     assert os.path.exists(tokname), f'{tokname} does not exist'
     assert os.path.isdir(tokname), f'{tokname} is not a directory'
     assert os.path.exists(os.path.join(
         tokname, 'content.xml')), f'content.xml not in {tokname}'
     assert os.path.exists(os.path.join(
         tokname, 'properties.xml')), f'properties.xml not in {tokname}'
     assert os.path.exists(os.path.join(
         tokname, 'thumbnail')), f'thumbnail not in {tokname}'
     assert os.path.exists(os.path.join(
         tokname, 'thumbnail_large')), f'thumbnail_large not in {tokname}'
Beispiel #6
0
 def test_asset_token_extract(self, tmpdir):
     tdir = 'MVToken'
     tfilename = tdir + '.rptok'
     # we don't come with a pre-assembled token, so assemble one
     targetAsset = GetAsset(tdir)
     targetAsset.assemble()
     assert os.path.exists(tfilename), f'{tfilename} does not exist'
     # The original is in 'MVToken', but the name is
     # 'MVToken+1' so we should have a copy there once extracted
     m = GetAsset(tfilename)
     m.extract()
     # assert False, m.save_to(None, target)
     assert m is not None
     assert m.fromdir is not None
     assert m.xmlfile is not None  # should this be None?
     assert m.zipfile is not None
     for asset in 'properties.xml', 'content.xml', 'thumbnail', 'thumbnail_large', '1d20.command', '1d20.xml':
         assert os.path.exists(os.path.join(tdir, asset))