-
-
Save sravantit25/2d7138cc48c79bbab6ff2c9ea1abafb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_test_images(): | |
""" | |
Prepares data and calls Qxf2's work anniversary lambda to generate a image | |
It takes test data defined in employee_test_data.json file to create the images | |
""" | |
try: | |
with open("employee_test_data.json") as json_file: | |
data = json.load(json_file) | |
employee_details = data["employees"] | |
print(employee_details) | |
image_paths = [] | |
for employee in employee_details: | |
emp_name = employee["emp_name"] | |
emp_joined_date = datetime.datetime.strptime( | |
employee["joined_date"], "%Y-%m-%d" | |
) | |
current_date = datetime.datetime.strptime( | |
employee["current_date"], "%Y-%m-%d" | |
) | |
message, quote_string = work_anniv.calculate_work_anniversary( | |
emp_joined_date, current_date, emp_name | |
) | |
imagepath = work_anniv.add_text_to_image(message, emp_name, quote_string) | |
image_paths.append(imagepath) | |
return image_paths | |
except Exception as error: | |
logging.info("Error generating test images: %s", error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment