def setUp(self) -> None:
        self.user1 = ep.users_create().json()
        self.user2 = ep.users_create().json()
        self.order1 = ep.orders_create(self.user1['user_id']).json()
        self.order2 = ep.orders_create(self.user2['user_id']).json()

        self.price = uniform(0, 100)
        self.balance_sufficient = self.price
        self.balance_insufficient = uniform(0, self.price - 1.0)

        self.item1 = ep.stock_create(self.price).json()
        ep.users_credit_add(self.user1['user_id'], self.balance_sufficient)
        ep.users_credit_add(self.user2['user_id'], self.balance_insufficient)

        ep.orders_add_item(self.order1['order_id'], self.item1['item_id'])
        ep.orders_add_item(self.order2['order_id'], self.item1['item_id'])
    def setUp(self) -> None:
        self.user1 = ep.users_create().json()
        self.user2 = ep.users_create().json()
        ep.users_credit_add(self.user1['user_id'], 100)
        self.item1 = ep.stock_create(20).json()
        ep.stock_add(self.item1["item_id"], 3)
        self.item2 = ep.stock_create(10).json()
        ep.stock_add(self.item2["item_id"], 3)
        self.order1 = ep.orders_create(self.user1['user_id']).json()
        self.order2 = ep.orders_create(self.user2['user_id']).json()
        self.order3 = ep.orders_create(self.user2['user_id']).json()

        # First order will have item 1 two times and item 2 once, total price is 50
        ep.orders_add_item(self.order1['order_id'], self.item1['item_id'])
        ep.orders_add_item(self.order1['order_id'], self.item1['item_id'])
        ep.orders_add_item(self.order1['order_id'], self.item2['item_id'])

        # Order 2 has total price of 20
        ep.orders_add_item(self.order2['order_id'], self.item1['item_id'])
示例#3
0
 def setUp(self):
     self.item_id = ep.stock_create(5.5).json()['item_id']
     self.item_id2 = ep.stock_create(1).json()['item_id']
     self.user_id = ep.users_create().json()['user_id']
     self.order_id = ep.orders_create(self.user_id).json()['order_id']