test: Variant Selector - Fetch next valid Attribute values fetching after selection of one
This commit is contained in:
parent
5a462db207
commit
2623046ba7
@ -72,18 +72,22 @@ class TestVariantSelector(unittest.TestCase):
|
|||||||
# Only L and M attribute values must be fetched since S is disabled
|
# Only L and M attribute values must be fetched since S is disabled
|
||||||
self.assertEqual(len(attr_data[0]["values"]), 2) # ['Medium', 'Large']
|
self.assertEqual(len(attr_data[0]["values"]), 2) # ['Medium', 'Large']
|
||||||
|
|
||||||
# def test_next_item_variant_values(self):
|
def test_next_item_variant_values(self):
|
||||||
# """
|
"""
|
||||||
# Test if on selecting an attribute value, the next possible values
|
Test if on selecting an attribute value, the next possible values
|
||||||
# are filtered accordingly.
|
are filtered accordingly.
|
||||||
# Values that dont apply should not be fetched.
|
Values that dont apply should not be fetched.
|
||||||
# E.g.
|
E.g.
|
||||||
# There is a ** Small-Red ** Tshirt. No other colour in this size.
|
There is a ** Small-Red ** Tshirt. No other colour in this size.
|
||||||
# On selecting ** Small **, only ** Red ** should be selectable next.
|
On selecting ** Small **, only ** Red ** should be selectable next.
|
||||||
# """
|
"""
|
||||||
# from erpnext.e_commerce.variant_selector.utils import get_next_attribute_and_values
|
from erpnext.e_commerce.variant_selector.utils import get_next_attribute_and_values
|
||||||
|
|
||||||
# next_values = get_next_attribute_and_values("Test-Tshirt-Temp", selected_attributes={
|
next_values = get_next_attribute_and_values("Test-Tshirt-Temp", selected_attributes={"Test Size": "Small"})
|
||||||
# "Colour": "Red"
|
next_colours = next_values["valid_options_for_attributes"]["Test Colour"]
|
||||||
# })
|
filtered_items = next_values["filtered_items"]
|
||||||
# print(next_values)
|
|
||||||
|
self.assertEqual(len(next_colours), 1)
|
||||||
|
self.assertEqual(next_colours.pop(), "Red")
|
||||||
|
self.assertEqual(len(filtered_items), 1)
|
||||||
|
self.assertEqual(filtered_items.pop(), "Test-Tshirt-Temp-S-R")
|
||||||
|
Loading…
Reference in New Issue
Block a user