Beispiel #1
0
    def post(self, request, *args, **kwargs):
        if "price" not in request.POST:
            return HttpResponseBadRequest(
                json.dumps({"message": "missing parameter"}))

        try:
            price = int(request.POST.get("price"))
        except ValueError:
            return HttpResponseBadRequest(
                json.dumps({"message": "price must be int"}))

        SeveralCosts.set_actual_cash_balance(price)
        return HttpResponse()
Beispiel #2
0
 def test_set_actual_cash_balance_nothing(self):
     SeveralCosts.objects.get(name="ActualCashBalance").delete()
     SeveralCosts.set_actual_cash_balance(2001)
     self.assertEqual(SeveralCosts.get_actual_cash_balance(), 2001)
Beispiel #3
0
 def test_set_actual_cash_balance(self):
     SeveralCosts.set_actual_cash_balance(2001)
     self.assertEqual(SeveralCosts.get_actual_cash_balance(), 2001)