test: fix flaky test

This commit is contained in:
Ankush Menat 2021-05-23 18:10:21 +05:30
parent 3aed662f46
commit 15f8a0fb22
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF

View File

@ -517,18 +517,15 @@ class TestItem(unittest.TestCase):
self.fail(f"Expected db index on these columns: {', '.join(expected_columns)}")
def test_attribute_completions(self):
expected_attrs = [{'attribute_value': 'Small'},
{'attribute_value': 'Extra Small'},
{'attribute_value': 'Extra Large'},
{'attribute_value': 'Large'},
{'attribute_value': '2XL'},
{'attribute_value': 'Medium'}]
expected_attrs = {"Small", "Extra Small", "Extra Large", "Large", "2XL", "Medium"}
attrs = get_item_attribute("Test Size")
self.assertEqual(attrs, expected_attrs)
received_attrs = {attr.attribute_value for attr in attrs}
self.assertEqual(received_attrs, expected_attrs)
attrs = get_item_attribute("Test Size", attribute_value="extra")
self.assertEqual(attrs, [{'attribute_value': 'Extra Small'}, {'attribute_value': 'Extra Large'}])
received_attrs = {attr.attribute_value for attr in attrs}
self.assertEqual(received_attrs, {"Extra Small", "Extra Large"})
def test_check_stock_uom_with_bin(self):
# this item has opening stock and stock_uom set in test_records.