Exemplo n.º 1
0
def mce_write_test(path):
    test.rm(test.tmp(path))
    test.call(test.build("mce_write"), [], [test.tmp(path)], test.tmp("stdout.txt"), [], {})
    test.call(test.build("mce_extract"), [], [test.tmp(path), "sample.xml"], test.tmp(path+".mce_write.mce_extract"), [], {})
    test.regr(test.docs(path+".mce_write.mce_extract"), test.tmp(path+".mce_write.mce_extract"), False)
    test.call(test.build("mce_extract"), [], [test.tmp(path), "--understands", "http://schemas.openxmlformats.org/Circles/v2", "sample.xml"], test.tmp(path+".mce_write.v2.mce_extract"), [], {})
    test.regr(test.docs(path+".mce_write.v2.mce_extract"), test.tmp(path+".mce_write.v2.mce_extract"), False)
Exemplo n.º 2
0
def mce_extract_test(path, part, namespaces, returncode):
	_part_="."+part.replace('.', '_')
	args=[test.docs(path), part]
	for namespace in namespaces:
		args.append("--understands"); args.append(namespace[1])
		_part_=_part_+"."+namespace[0]
	test.call(test.build("mce_extract"), [], args, test.tmp(path+_part_+".mce_extract"), [], {"return": returncode})
	test.regr(test.docs(path+_part_+".mce_extract"), test.tmp(path+_part_+".mce_extract"), True)
Exemplo n.º 3
0
def opc_proc_test(path, args, cmd):
    test.rm(test.tmp(path))
    test.cp(test.docs(path), test.tmp(path))
    call_args=[test.tmp(path)]
    call_args.extend(args)
    out=path+".opc_proc."+cmd+".txt"
    test.call(test.build("opc_proc"), [], call_args, test.tmp(out), [], {})
    test.regr(test.docs(out), test.tmp(out), True)
Exemplo n.º 4
0
def opc_zipwrite_test(path):
	test.rm(test.tmp(path))
	test.call(test.build("opc_zipwrite"), [], [test.tmp(path), "--import", "--delete", "--add", "--commit"], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_zipread"), [], ["--verify", test.tmp(path)], test.tmp(path+"_1.opc_zipread"), [], {})
	test.regr(test.docs(path+"_1.opc_zipread"), test.tmp(path+"_1.opc_zipread"), True)

	test.call(test.build("opc_zipwrite"), [], [test.tmp(path), "--import", "--commit"], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_zipread"), [], ["--verify", test.tmp(path)], test.tmp(path+"_2.opc_zipread"), [], {})
	test.regr(test.tmp(path+"_1.opc_zipread"), test.tmp(path+"_2.opc_zipread"), True)

	test.call(test.build("opc_zipwrite"), [], [test.tmp(path), "--import", "--trim"], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_zipread"), [], ["--verify", test.tmp(path)], test.tmp(path+"_3.opc_zipread"), [], {})
	test.regr(test.docs(path+"_3.opc_zipread"), test.tmp(path+"_3.opc_zipread"), True)

	test.call(test.build("opc_zipwrite"), [], [test.tmp(path), "--delete", "--commit"], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_zipread"), [], ["--verify", test.tmp(path)], test.tmp(path+"_4.opc_zipread"), [], {})
	test.regr(test.docs(path+"_4.opc_zipread"), test.tmp(path+"_4.opc_zipread"), True)

	test.call(test.build("opc_zipwrite"), [], [test.tmp(path), "--delete", "--trim"], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_zipread"), [], ["--verify", test.tmp(path)], test.tmp(path+"_5.opc_zipread"), [], {})
	test.regr(test.docs(path+"_5.opc_zipread"), test.tmp(path+"_5.opc_zipread"), True)
Exemplo n.º 5
0
def opc_relation_test(path):
	test.call(test.build("opc_relation"), [], [test.docs(path)], test.tmp(path+".opc_relation"), [], {})
	test.regr(test.docs(path+".opc_relation"), test.tmp(path+".opc_relation"), True)
	test.call(test.build("opc_relation"), [], [test.docs(path), "rId1"], test.tmp(path+".opc_relation.rId1"), [], {})
	test.regr(test.docs(path+".opc_relation.rId1"), test.tmp(path+".opc_relation.rId1"), True)
	test.call(test.build("opc_relation"), [], [test.docs(path), "word/document.xml", "rId1"], test.tmp(path+".opc_relation.word-document.rId1"), [], {})
	test.regr(test.docs(path+".opc_relation.word-document.rId1"), test.tmp(path+".opc_relation.word-document.rId1"), True)
Exemplo n.º 6
0
def opc_trim_test(path):
	test.rm(test.tmp(path))
	test.cp(test.docs(path), test.tmp(path))
	test.call(test.build("opc_dump"), [], [test.docs(path)], test.tmp(path+"_1.opc_trim.opc_dump"), [], {})
	test.regr(test.docs(path+".opc_dump"), test.tmp(path+"_1.opc_trim.opc_dump"), True)
	test.call(test.build("opc_trim"), [], [test.tmp(path)], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_dump"), [], [test.docs(path)], test.tmp(path+"_2.opc_trim.opc_dump"), [], {})
	test.regr(test.tmp(path+"_1.opc_trim.opc_dump"), test.tmp(path+"_2.opc_trim.opc_dump"), True)
	test.call(test.build("opc_trim"), [], [test.tmp(path)], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_dump"), [], [test.docs(path)], test.tmp(path+"_3.opc_trim.opc_dump"), [], {})
	test.regr(test.tmp(path+"_2.opc_trim.opc_dump"), test.tmp(path+"_3.opc_trim.opc_dump"), True)
	test.call(test.build("opc_trim"), [], [test.tmp(path)], test.tmp("stdout.txt"), [], {})
	test.call(test.build("opc_dump"), [], [test.docs(path)], test.tmp(path+"_4.opc_trim.opc_dump"), [], {})
	test.regr(test.tmp(path+"_3.opc_trim.opc_dump"), test.tmp(path+"_4.opc_trim.opc_dump"), True)
Exemplo n.º 7
0
def opc_zipread_test(path):
	test.call(test.build("opc_zipread"), [], ["--verify", test.docs(path)], test.tmp(path+".opc_zipread"), [], {})
	test.regr(test.docs(path+".opc_zipread"), test.tmp(path+".opc_zipread"), True)
Exemplo n.º 8
0
def opc_zipextract_test(path):
	test.call(test.build("opc_zipextract"), [], [test.docs(path), "word/document.xml"], test.tmp(path+".opc_zipextract"), [], {})
	test.regr(test.docs(path+".opc_zipextract"), test.tmp(path+".opc_zipextract"), True)
Exemplo n.º 9
0
def opc_xml2_test(path):
	test.call(test.build("opc_xml2"), [], [test.docs(path)], test.tmp(path+".opc_xml2"), [], {})
	test.regr(test.docs(path+".opc_xml2"), test.tmp(path+".opc_xml2"), True)
Exemplo n.º 10
0
def opc_text_test(path):
	test.call(test.build("opc_text"), [], [test.docs(path)], test.tmp(path+".opc_text.html"), [], {})
	test.regr(test.docs(path+".opc_text.html"), test.tmp(path+".opc_text.html"), True)
Exemplo n.º 11
0
def opc_image_test(path):
	test.call(test.build("opc_image"), [], [test.docs(path), test.tmp("")], test.tmp(path+".opc_image"), [], {})
	test.regr(test.docs(path+".opc_image"), test.tmp(path+".opc_image"), True)
Exemplo n.º 12
0
def opc_mem_test(path):
	test.call(test.build("opc_mem"), [], [test.docs(path)], test.tmp(path+".opc_mem"), [], {})
	test.regr(test.docs(path+".opc_dump"), test.tmp(path+".opc_mem"), True)
Exemplo n.º 13
0
def opc_extract_test(path, part):
	out_ext=".opc_extract."+part.replace("/", "-")
	test.call(test.build("opc_extract"), [], [test.docs(path), part], test.tmp(path)+out_ext, [], {})
	test.regr(test.docs(path)+out_ext, test.tmp(path)+out_ext, False)
Exemplo n.º 14
0
def mcepp_test(path):
    test.rm(test.tmp(path))
    test.call(test.build("mcepp"), [], [test.docs(path)], test.tmp(path+".mcepp"), [], {})
    test.regr(test.docs(path+".mcepp"), test.tmp(path+".mcepp"), True)
Exemplo n.º 15
0
		mce_extract_test("mce.zip", "circles-processcontent.xml", [["v2", "http://schemas.openxmlformats.org/Circles/v2"]], 0)

		mce_extract_test("mce.zip", "circles-processcontent-ns.xml", [], 0)
		mce_extract_test("mce.zip", "circles-processcontent-ns.xml", [["ext", "http://schemas.openxmlformats.org/Circles/extension"]], 0)

		mce_extract_test("mce.zip", "circles-mustunderstand.xml", [], 2)
		mce_extract_test("mce.zip", "circles-mustunderstand.xml", [["v2", "http://schemas.openxmlformats.org/Circles/v2"]], 0)

		mce_write_test("mce_write.zip")

		mcepp_test("extLst.xml")
		mcepp_test("mce-test-1.xml")
		mcepp_test("mce-test-2.xml")

		opc_proc_test("OOXMLI1.docx", ["--delete", "customXml/item1.xml", "--dump"], "delete")
		opc_proc_test("OOXMLI1.docx", ["--create", "readme.txt", "text/plain", "0", test.docs("Readme.txt"), "--delete", "readme.txt", "--dump"], "create_delete")

	else:
		ignore_list = {  }
		skip_list = {  }
		ignore_file = os.path.join(generate_path, "opc_generate.ignore")
		skip_file = os.path.join(generate_path, "opc_generate.skip")
		if os.path.exists(ignore_file):
			f=open(ignore_file, "r")
			ignore_list=eval(f.read())
			f.close()
#		print "ignore_list="+str(ignore_list)
		if os.path.exists(skip_file):
			f=open(skip_file, "r")
			for line in f.readlines():
				line=line.strip()