def test_PDFCompare_withWrongFile(): pdfCompare = PDFCompare() lDict = {"pdfThatdoesntExist.pdf": __getDictStructure()} pdfCompare.compare_multiple(lDict) assert lDict["pdfThatdoesntExist.pdf"]["Status"] == 'NOK'
def __uploadNewFile(fileNameAndPath): lFileDetails = PDFCompareDetails() lFileDetails.fileName = str(fileNameAndPath) lPDFCompare = PDFCompare() lFileDetails = lPDFCompare.uploadNewReferenceFile(lFileDetails) assert lFileDetails.Status == "OK" return lFileDetails.newUUID
def test_PDFCompare_wrongInput(): pdfCompare = PDFCompare() lDict = {"1234": __getDictStructure()} # Remove ReferenceID - should give an error during call lDict["1234"].pop("referenceID") pdfCompare.compare_multiple(lDict) assert lDict["1234"].get("Status", None) == "NOK"
def test_PDFCompare_withWrongURL(): pdfCompare = PDFCompare(baseURL="http://franzi.fritzi:4711") lFile = Path( getcwd()).joinpath("tests").joinpath("pdfs").joinpath("sample.pdf") lDict = {lFile: __getDictStructure()} pdfCompare.compare_multiple(lDict) assert lDict[lFile]["Status"] == "NOK" assert "Config wrong?" in lDict[lFile]["StatusText"]
def test_PDFCompare_withFileLoadOK(): pdfCompare = PDFCompare() lFile = Path( getcwd()).joinpath("tests").joinpath("pdfs").joinpath("sample.pdf") lDict = {lFile: __getDictStructure()} lDict[lFile]["referenceID"] = newOriginalFile1_UUID pdfCompare.compare_multiple(lDict) assert len(lDict[lFile]["newUUID"]) > 0 assert lDict[lFile]["Status"] == "OK"
def test_PDFCompare_withDataClass(): pdfCompare = PDFCompare() pdfDataClass = PDFCompareDetails() pdfDataClass.fileName = Path( getcwd()).joinpath("tests").joinpath("pdfs").joinpath("sample.pdf") pdfDataClass.referenceID = "12345" lDict = {pdfDataClass.fileName: pdfDataClass} pdfCompare.compare_multiple(lDict) assert lDict[pdfDataClass.fileName].Status == "NOK" assert "Config wrong?" in lDict[pdfDataClass.fileName].StatusText
def doPDFComparison(self, lValue, lFieldnameForResults="DOC_Compare"): lFiles = self.browserSession.findNewFiles() if len(lFiles) > 1: # fixme: Do something! There were more than 1 files since last check. Damn logger.critical(f"There were {len(lFiles)} files new since last check. Can't handle that. ") raise Exception elif len(lFiles) == 1: # Wonderful. Let's do the PDF-Comparison lPDFDataClass = PDFCompareDetails() lPDFDataClass.fileName = lFiles[0][0] lPDFDataClass.referenceID = lValue lDict = {"": lPDFDataClass} lPDFCompare = PDFCompare() lDict = lPDFCompare.compare_multiple(lDict) self.testcaseDataDict[lFieldnameForResults + "_Status"] = lDict[""].Status self.testcaseDataDict[lFieldnameForResults + "_Results"] = lDict[""].StatusText