mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-29 01:42:37 +02:00
Added test checking correct bill_type validation
This commit is contained in:
parent
b0a67a5156
commit
bf9601377d
1 changed files with 35 additions and 0 deletions
|
@ -1013,3 +1013,38 @@ class TestAPI(IhatemoneyTestCase):
|
||||||
headers=self.get_auth("raclette"),
|
headers=self.get_auth("raclette"),
|
||||||
)
|
)
|
||||||
self.assertStatus(400, req)
|
self.assertStatus(400, req)
|
||||||
|
|
||||||
|
def test_validate_bill_type(self):
|
||||||
|
self.api_create("raclette")
|
||||||
|
self.api_add_member("raclette", "zorglub")
|
||||||
|
|
||||||
|
|
||||||
|
req = self.client.post(
|
||||||
|
"/api/projects/raclette/bills",
|
||||||
|
data={
|
||||||
|
"date": "2011-08-10",
|
||||||
|
"what": "fromage",
|
||||||
|
"payer": "1",
|
||||||
|
"payed_for": ["1"],
|
||||||
|
"bill_type": "wrong_bill_type",
|
||||||
|
"amount": "50",
|
||||||
|
},
|
||||||
|
headers=self.get_auth("raclette")
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertStatus(400, req)
|
||||||
|
|
||||||
|
req = self.client.post(
|
||||||
|
"/api/projects/raclette/bills",
|
||||||
|
data={
|
||||||
|
"date": "2011-08-10",
|
||||||
|
"what": "fromage",
|
||||||
|
"payer": "1",
|
||||||
|
"payed_for": ["1"],
|
||||||
|
"bill_type": "Expense",
|
||||||
|
"amount": "50",
|
||||||
|
},
|
||||||
|
headers=self.get_auth("raclette")
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertStatus(201, req)
|
Loading…
Reference in a new issue