diff options
| author | JocelynDelalande <JocelynDelalande@users.noreply.github.com> | 2017-12-27 15:58:40 +0100 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2017-12-27 15:58:40 +0100 |
| commit | 4d359ce11ba8bc5ea023476ffdfa0293e6c2f02e (patch) | |
| tree | 3511214dba4ba496dcdf85aa28efad6c47eab722 /ihatemoney/tests/tests.py | |
| parent | 0189313c1fd62e489d879e56150c942b5d071e1a (diff) | |
| download | ihatemoney-mirror-4d359ce11ba8bc5ea023476ffdfa0293e6c2f02e.zip ihatemoney-mirror-4d359ce11ba8bc5ea023476ffdfa0293e6c2f02e.tar.gz ihatemoney-mirror-4d359ce11ba8bc5ea023476ffdfa0293e6c2f02e.tar.bz2 | |
Fix PUT api/project/:code/members/:id (#297)
* Fix PUT api/project/:code/members/:id
Before that commit, every PUT *must* change the name of the members, so that was :
- no idempotence,
- no ability to change only weight
fix #295
* Remove redundant comment
Diffstat (limited to 'ihatemoney/tests/tests.py')
| -rw-r--r-- | ihatemoney/tests/tests.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ihatemoney/tests/tests.py b/ihatemoney/tests/tests.py index 6708ca8..97e9df3 100644 --- a/ihatemoney/tests/tests.py +++ b/ihatemoney/tests/tests.py @@ -1155,7 +1155,8 @@ class APITestCase(IhatemoneyTestCase): # edit this member req = self.client.put("/api/projects/raclette/members/1", data={ - "name": "Fred" + "name": "Fred", + "weight": 2, }, headers=self.get_auth("raclette")) self.assertStatus(200, req) @@ -1166,6 +1167,15 @@ class APITestCase(IhatemoneyTestCase): self.assertStatus(200, req) self.assertEqual("Fred", json.loads(req.data.decode('utf-8'))["name"]) + self.assertEqual(2, json.loads(req.data.decode('utf-8'))["weight"]) + + # edit this member with same information + # (test PUT idemopotence) + req = self.client.put("/api/projects/raclette/members/1", data={ + "name": "Fred" + }, headers=self.get_auth("raclette")) + + self.assertStatus(200, req) # delete a member @@ -1175,7 +1185,6 @@ class APITestCase(IhatemoneyTestCase): self.assertStatus(200, req) # the list of members should be empty - # get the list of members (should be empty) req = self.client.get("/api/projects/raclette/members", headers=self.get_auth("raclette")) |
