test: refactor BOM quality template test
This commit is contained in:
parent
dc257665f1
commit
8e559f01c8
@ -428,7 +428,7 @@ class BOM(WebsiteGenerator):
|
||||
|
||||
def clear_inspection(self):
|
||||
if not self.inspection_required:
|
||||
self.set('quality_inspection_template', None)
|
||||
self.quality_inspection_template = None
|
||||
|
||||
def validate_main_item(self):
|
||||
""" Validate main FG item"""
|
||||
|
@ -6,7 +6,6 @@ from collections import deque
|
||||
from functools import partial
|
||||
|
||||
import frappe
|
||||
from frappe.test_runner import make_test_records
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
from frappe.utils import cstr, flt
|
||||
|
||||
@ -20,15 +19,9 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import
|
||||
from erpnext.tests.test_subcontracting import set_backflush_based_on
|
||||
|
||||
test_records = frappe.get_test_records('BOM')
|
||||
test_dependencies = ["Item", "Quality Inspection Template"]
|
||||
|
||||
class TestBOM(FrappeTestCase):
|
||||
def setUp(self):
|
||||
if not frappe.get_value('Item', '_Test Item'):
|
||||
make_test_records('Item')
|
||||
|
||||
if not frappe.get_value('Quality Inspection Template', '_Test Quality Inspection Template'):
|
||||
make_test_records('Quality Inspection_Template')
|
||||
|
||||
def test_get_items(self):
|
||||
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
|
||||
items_dict = get_bom_items_as_dict(bom=get_default_bom(),
|
||||
@ -500,17 +493,19 @@ class TestBOM(FrappeTestCase):
|
||||
|
||||
def test_clear_inpection_quality(self):
|
||||
|
||||
bom = frappe.copy_doc(test_records[2])
|
||||
bom.is_active = 0
|
||||
bom = frappe.copy_doc(test_records[2], ignore_no_copy=True)
|
||||
bom.docstatus = 0
|
||||
bom.is_default = 0
|
||||
bom.quality_inspection_template = "_Test Quality Inspection Template"
|
||||
bom.inspection_required = 1
|
||||
bom.save()
|
||||
bom.reload()
|
||||
|
||||
self.assertEqual(bom.quality_inspection_template, '_Test Quality Inspection Template')
|
||||
|
||||
bom.inspection_required = 0
|
||||
bom.save()
|
||||
bom.load_from_db()
|
||||
bom.reload()
|
||||
|
||||
self.assertEqual(bom.quality_inspection_template, None)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
[
|
||||
{
|
||||
"quality_inspection_template_name" : "_Test Quality Inspection Template",
|
||||
"doctype": "Quality Inspection Template",
|
||||
"item_quality_inspection_parameter" : [
|
||||
{
|
||||
"specification": "_Test Param",
|
||||
|
Loading…
x
Reference in New Issue
Block a user