Skip to content

Commit f5da2d6

Browse files
author
Fernando Ojeda
committed
Unit test suspend cloud server order
1 parent ad84d58 commit f5da2d6

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

tests/managers/ordering_tests.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -553,23 +553,15 @@ def test_get_item_price_id_without_capacity_restriction(self):
553553
category1 = {'categoryCode': 'cat1'}
554554
price1 = {'id': 1234, 'locationGroupId': '', 'categories': [category1]}
555555

556-
with mock.patch.object(self.ordering, 'get_item_price_id') as list_mock:
557-
list_mock.return_value = [price1]
556+
price_id = self.ordering.get_item_price_id("8", price1, None)
558557

559-
prices = self.ordering.get_item_price_id("8", price1)
560-
561-
list_mock.assert_called_once_with("8", price1)
562-
self.assertEqual(1234, prices[0]['id'])
558+
self.assertEqual(1234, price_id)
563559

564560
def test_get_item_price_id_with_capacity_restriction(self):
565561
category1 = {'categoryCode': 'cat1'}
566562
price1 = {'id': 1234, 'locationGroupId': '', "capacityRestrictionMaximum": "16",
567563
"capacityRestrictionMinimum": "1", 'categories': [category1]}
568564

569-
with mock.patch.object(self.ordering, 'get_item_price_id') as list_mock:
570-
list_mock.return_value = [price1]
571-
572-
prices = self.ordering.get_item_price_id("8", price1)
565+
price_id = self.ordering.get_item_price_id("8", price1, None)
573566

574-
list_mock.assert_called_once_with("8", price1)
575-
self.assertEqual(1234, prices[0]['id'])
567+
self.assertEqual(1234, price_id)

0 commit comments

Comments
 (0)