def test_payment_non_existing_user(self): status_before = ep.payment_status(self.order1['order_id']) self.assertFalse(status_before.ok) res = ep.payment_pay(self.order1['order_id'], self.order1['order_id'], self.price) status_after = ep.payment_status(self.order1['order_id']) self.assertFalse(res.ok) self.assertFalse(status_after.ok)
def test_payment_insufficient_funds(self): status_before = ep.payment_status(self.order2['order_id']) self.assertFalse(status_before.ok) balance_before = ep.users_find(self.user1['user_id']).json()['credit'] res = ep.payment_pay(self.user2['user_id'], self.order2['order_id'], self.price) status_after = ep.payment_status(self.order1['order_id']) balance_after = ep.users_find(self.user1['user_id']).json()['credit'] self.assertFalse(res.ok) self.assertFalse(status_after.ok) self.assertEqual(balance_before, balance_after)