def check_commission(request): if request.method == "POST": serializer = CheckCommissionSerializer(data=request.data) if serializer.is_valid(): cc = Sales() return Response(cc.check_commission(request.data["sellers_id"], request.data["amount"]), status=status.HTTP_200_OK) return Response({"message": "Bad request. Please check syntax and try again"}, status=status.HTTP_400_BAD_REQUEST)
def test_check_commission(self): self.assertEqual(Sales.check_commission(self, 1, 1325.00), {"seller_notified": False}) self.assertEqual(Sales.check_commission(self, 2, 3200.00), {"seller_notified": False})