mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-17 08:28:44 +00:00
Merge pull request #57754 from mihir-kandoi/fix/isolate-disabled-attribute-test-fixtures
test: isolate the disabled item attribute test fixtures
This commit is contained in:
@@ -424,12 +424,33 @@ class TestItem(ERPNextTestSuite):
|
||||
self.assertRaises(InvalidItemAttributeValueError, attribute.save)
|
||||
|
||||
def test_disabled_attribute_blocks_only_attribute_changes(self):
|
||||
frappe.delete_doc_if_exists("Item", "_Test Variant Item-L", force=1)
|
||||
frappe.delete_doc_if_exists("Item", "_Test Disabled Attribute Template-L", force=1)
|
||||
frappe.delete_doc_if_exists("Item", "_Test Disabled Attribute Template", force=1)
|
||||
frappe.delete_doc_if_exists("Item Attribute", "_Test Disabled Size", force=1)
|
||||
|
||||
variant = create_variant("_Test Variant Item", {"Test Size": "Large"})
|
||||
attribute = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Item Attribute",
|
||||
"attribute_name": "_Test Disabled Size",
|
||||
"item_attribute_values": [
|
||||
{"attribute_value": "Large", "abbr": "L"},
|
||||
{"attribute_value": "Small", "abbr": "S"},
|
||||
],
|
||||
}
|
||||
).insert()
|
||||
|
||||
template = make_item(
|
||||
"_Test Disabled Attribute Template",
|
||||
{
|
||||
"has_variants": 1,
|
||||
"variant_based_on": "Item Attribute",
|
||||
"attributes": [{"attribute": attribute.name}],
|
||||
},
|
||||
)
|
||||
|
||||
variant = create_variant(template.name, {attribute.name: "Large"})
|
||||
variant.save()
|
||||
|
||||
attribute = frappe.get_doc("Item Attribute", "Test Size")
|
||||
attribute.disabled = 1
|
||||
attribute.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user