-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #992 from frappe/version-14-hotfix
chore: release v14
- Loading branch information
Showing
11 changed files
with
135 additions
and
32 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,17 @@ | |
) | ||
from hrms.hr.doctype.job_offer.test_job_offer import create_job_offer | ||
from hrms.payroll.doctype.salary_slip.test_salary_slip import make_holiday_list | ||
from hrms.tests.test_utils import create_company | ||
|
||
|
||
class TestEmployeeOnboarding(FrappeTestCase): | ||
def setUp(self): | ||
create_company() | ||
if frappe.db.exists("Employee Onboarding", {"employee_name": "Test Researcher"}): | ||
frappe.delete_doc("Employee Onboarding", {"employee_name": "Test Researcher"}) | ||
frappe.db.sql("delete from `tabEmployee Onboarding` where employee_name=%s", "Test Researcher") | ||
|
||
project = "Employee Onboarding : [email protected]" | ||
frappe.db.sql("delete from tabProject where name=%s", project) | ||
frappe.db.sql("delete from tabProject where project_name=%s", project) | ||
frappe.db.sql("delete from tabTask where project=%s", project) | ||
|
||
def test_employee_onboarding_incomplete_task(self): | ||
|
@@ -70,6 +72,26 @@ def test_employee_onboarding_incomplete_task(self): | |
employee.insert() | ||
self.assertEqual(employee.employee_name, "Test Researcher") | ||
|
||
def test_mark_onboarding_as_completed(self): | ||
onboarding = create_employee_onboarding() | ||
|
||
# before marking as completed | ||
self.assertEqual(onboarding.boarding_status, "Pending") | ||
project = frappe.get_doc("Project", onboarding.project) | ||
self.assertEqual(project.status, "Open") | ||
for task_status in frappe.get_all("Task", dict(project=project.name), pluck="status"): | ||
self.assertEqual(task_status, "Open") | ||
|
||
onboarding.reload() | ||
onboarding.mark_onboarding_as_completed() | ||
|
||
# after marking as completed | ||
self.assertEqual(onboarding.boarding_status, "Completed") | ||
project.reload() | ||
self.assertEqual(project.status, "Completed") | ||
for task_status in frappe.get_all("Task", dict(project=project.name), pluck="status"): | ||
self.assertEqual(task_status, "Completed") | ||
|
||
def tearDown(self): | ||
frappe.db.rollback() | ||
|
||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,12 @@ | |
|
||
import frappe | ||
from frappe.tests.utils import FrappeTestCase | ||
from frappe.utils import nowdate | ||
|
||
from erpnext.setup.doctype.designation.test_designation import create_designation | ||
from erpnext.setup.doctype.employee.test_employee import make_employee | ||
|
||
from hrms.hr.doctype.job_offer.test_job_offer import create_job_offer | ||
from hrms.tests.test_utils import create_job_applicant | ||
|
||
|
||
class TestJobApplicant(FrappeTestCase): | ||
|
@@ -29,30 +33,23 @@ def test_job_applicant_naming(self): | |
).insert() | ||
self.assertEqual(applicant.name, "[email protected]") | ||
|
||
def tearDown(self): | ||
frappe.db.rollback() | ||
|
||
def test_update_applicant_to_employee(self): | ||
applicant = create_job_applicant() | ||
job_offer = create_job_offer(job_applicant=applicant.name, status="Awaiting Response") | ||
job_offer.save() | ||
|
||
def create_job_applicant(**args): | ||
args = frappe._dict(args) | ||
# before creating employee | ||
self.assertEqual(applicant.status, "Open") | ||
self.assertEqual(job_offer.status, "Awaiting Response") | ||
|
||
filters = { | ||
"applicant_name": args.applicant_name or "_Test Applicant", | ||
"email_id": args.email_id or "[email protected]", | ||
} | ||
# create employee | ||
make_employee(user=applicant.name, job_applicant=applicant.name) | ||
|
||
if frappe.db.exists("Job Applicant", filters): | ||
return frappe.get_doc("Job Applicant", filters) | ||
# after creating employee | ||
applicant.reload() | ||
self.assertEqual(applicant.status, "Accepted") | ||
job_offer.reload() | ||
self.assertEqual(job_offer.status, "Accepted") | ||
|
||
job_applicant = frappe.get_doc( | ||
{ | ||
"doctype": "Job Applicant", | ||
"status": args.status or "Open", | ||
"designation": create_designation().name, | ||
} | ||
) | ||
|
||
job_applicant.update(filters) | ||
job_applicant.save() | ||
|
||
return job_applicant | ||
def tearDown(self): | ||
frappe.db.rollback() |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
from frappe.utils import add_months, get_first_day, get_last_day, getdate, now_datetime | ||
|
||
from erpnext.setup.doctype.department.department import get_abbreviated_name | ||
from erpnext.setup.doctype.designation.test_designation import create_designation | ||
from erpnext.setup.utils import enable_all_roles_and_domains | ||
|
||
|
||
|
@@ -92,3 +93,25 @@ def create_department(name: str, company: str = "_Test Company") -> str: | |
department.update({"doctype": "Department", "department_name": name, "company": "_Test Company"}) | ||
department.insert() | ||
return department.name | ||
|
||
|
||
def create_job_applicant(**args): | ||
args = frappe._dict(args) | ||
filters = { | ||
"applicant_name": args.applicant_name or "_Test Applicant", | ||
"email_id": args.email_id or "[email protected]", | ||
} | ||
|
||
if frappe.db.exists("Job Applicant", filters): | ||
return frappe.get_doc("Job Applicant", filters) | ||
|
||
job_applicant = frappe.get_doc( | ||
{ | ||
"doctype": "Job Applicant", | ||
"status": args.status or "Open", | ||
"designation": create_designation().name, | ||
} | ||
) | ||
job_applicant.update(filters) | ||
job_applicant.save() | ||
return job_applicant |