refactor(test): make tests for queries and Project deterministic

This commit is contained in:
ruthra kumar
2025-05-04 20:26:29 +05:30
parent 3ecc39a51f
commit eda7595179
2 changed files with 23 additions and 7 deletions

View File

@@ -23,6 +23,29 @@ class UnitTestProject(UnitTestCase):
class TestProject(IntegrationTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.make_projects()
@classmethod
def make_projects(cls):
records = [
{
"doctype": "Project",
"company": "_Test Company",
"project_name": "_Test Project",
"status": "Open",
}
]
cls.projects = []
for x in records:
if not frappe.db.exists("Project", {"project_name": x.get("project_name")}):
cls.projects.append(frappe.get_doc(x).insert())
else:
cls.projects.append(frappe.get_doc("Project", {"project_name": x.get("project_name")}))
def test_project_with_template_having_no_parent_and_depend_tasks(self):
project_name = "Test Project with Template - No Parent and Dependend Tasks"
frappe.db.sql(""" delete from tabTask where project = %s """, project_name)

View File

@@ -1,7 +0,0 @@
[
{
"company": "_Test Company",
"project_name": "_Test Project",
"status": "Open"
}
]