コード例 #1
0
 def test_token_assemble_no_gmname_change(self, tmpdir):
     # TODO this will fail if MVToken ever gets a gmName
     tokenname = random_string()
     m = GetAsset('MVToken')
     assert m is not None
     m.assemble(tokenname)
     m = GetAsset(tokenname + '.' + tagset.token.ext)
     assert m is not None
     assert 'gmName' not in [x.tag for x in m.root.iterchildren()]
コード例 #2
0
 def test_token_assemble_sha_gmname(self, tmpdir):
     tokenname = 'Lib:' + random_string()
     tokennameq = tokenname.replace(':', '-')
     m = GetAsset('MVToken')
     assert m is not None
     m.root.name = objectify.StringElement(tokenname)
     m.assemble(tokennameq)
     m = GetAsset(MacroNameQuote(tokennameq + '.' + tagset.token.ext))
     assert m is not None
     assert 'gmName' in [x.tag for x in m.root.iterchildren()]
     assert m.root.gmName == git_tag_str
コード例 #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()]
コード例 #4
0
 def test_asset_token_extract_macro_dryrun(self, tmpdir):
     '''When extracting with dryrun, a token should not actually
     be created'''
     newname = random_string()
     macro_name = 'MVToken'
     m = GetAsset(macro_name)
     assert m is not None
     m.assemble(newname)
     n = GetAsset(newname + '.rptok')
     assert n is not None
     assert n.fromdir is not None
     assert n.xmlfile is not None
     assert n.zipfile is not None
     n.assemble(dryrun=True)
     assert not os.path.exists(os.path.join('.', newname))
     should_have = os.path.join('.', newname, 'properties.xml')
     assert not os.path.exists(
         should_have), f"{should_have} exists when using dryrun"
     macro_xml = os.path.join('.', newname, '1d20.xml')
     assert not os.path.exists(
         macro_xml), f"{macro_xml} exists when using dryrun"
     macro_cmd = os.path.join('.', newname, '1d20.command')
     assert not os.path.exists(
         macro_cmd), f"{macro_cmd} exists when using dryrun"