resumate / tests /test_resumate.py
gperdrizet's picture
Added mocking to test to avoid API calls where possible
a974c1c verified
"""
Test for resume generation functionality
"""
import json
import unittest
from functions.gradio import process_inputs
from functions.writer_agent import write_resume
class TestResumeGeneration(unittest.TestCase):
"""Test to run resume generation on pre-defined inputs."""
def setUp(self):
"""Set up the test case with pre-defined inputs."""
self.linkedin_pdf_path = "tests/test_data/linkedin_profile.pdf"
self.github_username = "gperdrizet"
with open('tests/test_data/sample_job.txt', 'r', encoding='utf-8') as f:
self.job_post_text = f.read().strip()
with open('tests/test_data/github_repos.json', 'r', encoding='utf-8') as f:
self.github_repositories = json.load(f)
with open('tests/test_data/job_call.json', 'r', encoding='utf-8') as f:
self.job_call = json.load(f)
with open('tests/test_data/linkedin_resume.json', 'r', encoding='utf-8') as f:
self.linkedin_resume = json.load(f)
def test_process_inputs(self):
"""Test input preprocessing for resume generation with pre-defined inputs."""
result = process_inputs(
linkedin_pdf_path=self.linkedin_pdf_path,
github_username=self.github_username,
job_post_text=self.job_post_text,
)
print(result)
def test_write_resume(self):
"""Test resume writing functionality with pre-defined inputs."""
result = write_resume(self.linkedin_resume, self.github_repositories, self.job_call)
print(result)