-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_Simple_BOT_Letter_PDF_Validations.py
38 lines (30 loc) · 1.59 KB
/
test_Simple_BOT_Letter_PDF_Validations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from configparser import ConfigParser
import pandas as pd
from src.ExtractFigures import pdf_images_extraction, compare_pdf_images
from src.ValidateText import validate_static_dynamic_text_pdf, validate_dynamic_text_pdf, attachPDF
config_object = ConfigParser()
config_object.read("configurations.ini")
rootdir=os.getcwd()
def test_simple_PDF_Attachment_BOT_Letter():
attachPDF(rootdir+config_object["PDFPath_Simple"]["pdfpath"])
def test_easy_BOT_Letter_Stattic_Text_Validation():
validate_static_dynamic_text_pdf(rootdir+config_object["PDFPath_Simple"]["pdfpath"],
rootdir+config_object["TextValidation_Simple"]["inputdataexcelpath"])
def test_easy_BOT_Letter_User_Info_Dynamic_Text_Validation():
testresult = True
df = pd.read_excel(rootdir + config_object["TextValidation_Simple"]["inputdataexcelpath"])
for index, row in df.iterrows():
try:
if row["TextType"] == 'Dynamic':
validate_dynamic_text_pdf(rootdir + config_object["PDFPath_Simple"]["pdfpath"],
row, row["Page"])
except AssertionError:
testresult = False
pass
assert testresult
def test_easy_BOT_Letter_Logos_Validation():
pdf_images_extraction(rootdir + config_object["PDFPath_Simple"]["pdfpath"],
rootdir + config_object["ImageValidation_Simple"]["actualimages"])
compare_pdf_images(rootdir + config_object["ImageValidation_Simple"]["actualimages"],
rootdir + config_object["ImageValidation_Simple"]["expectedimages"])