Skip to content

Commit

Permalink
Swapping Out 'Fred' for 'Jeanne' in Docs/API – Personal Peacekeeping 😊 (
Browse files Browse the repository at this point in the history
  • Loading branch information
almet authored Nov 12, 2023
1 parent e507b44 commit aab32a2
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 98 deletions.
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ You can get all the members with a `GET` on
[{"weight": 1, "activated": true, "id": 31, "name": "Arnaud"},
{"weight": 1, "activated": true, "id": 32, "name": "Alexis"},
{"weight": 1, "activated": true, "id": 33, "name": "Olivier"},
{"weight": 1, "activated": true, "id": 34, "name": "Fred"}]
{"weight": 1, "activated": true, "id": 34, "name": "Jeanne"}]

Add a member with a `POST` request on `/api/projects/<id>/members`:

Expand Down Expand Up @@ -244,7 +244,7 @@ You can get some project stats with a `GET` on
"balance": 10.5
},
{
"member": {"activated": true, "id": 2, "name": "fred", "weight": 1.0},
"member": {"activated": true, "id": 2, "name": "jeanne", "weight": 1.0},
"paid": 5,
"spent": 15.5,
"balance": -10.5
Expand Down
38 changes: 19 additions & 19 deletions ihatemoney/tests/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def test_member(self):
# edit the participant
req = self.client.put(
"/api/projects/raclette/members/1",
data={"name": "Fred", "weight": 2},
data={"name": "Jeanne", "weight": 2},
headers=self.get_auth("raclette"),
)

Expand All @@ -326,14 +326,14 @@ def test_member(self):
)

self.assertStatus(200, req)
assert "Fred" == json.loads(req.data.decode("utf-8"))["name"]
assert "Jeanne" == json.loads(req.data.decode("utf-8"))["name"]
assert 2 == json.loads(req.data.decode("utf-8"))["weight"]

# edit this member with same information
# (test PUT idemopotence)
# (test PUT idempotence)
req = self.client.put(
"/api/projects/raclette/members/1",
data={"name": "Fred"},
data={"name": "Jeanne"},
headers=self.get_auth("raclette"),
)

Expand All @@ -342,7 +342,7 @@ def test_member(self):
# de-activate the participant
req = self.client.put(
"/api/projects/raclette/members/1",
data={"name": "Fred", "activated": False},
data={"name": "Jeanne", "activated": False},
headers=self.get_auth("raclette"),
)
self.assertStatus(200, req)
Expand All @@ -356,7 +356,7 @@ def test_member(self):
# re-activate the participant
req = self.client.put(
"/api/projects/raclette/members/1",
data={"name": "Fred", "activated": True},
data={"name": "Jeanne", "activated": True},
headers=self.get_auth("raclette"),
)

Expand Down Expand Up @@ -388,7 +388,7 @@ def test_bills(self):

# add participants
self.api_add_member("raclette", "zorglub")
self.api_add_member("raclette", "fred")
self.api_add_member("raclette", "jeanne")
self.api_add_member("raclette", "quentin")

# get the list of bills (should be empty)
Expand Down Expand Up @@ -429,7 +429,7 @@ def test_bills(self):
"payer_id": 1,
"owers": [
{"activated": True, "id": 1, "name": "zorglub", "weight": 1},
{"activated": True, "id": 2, "name": "fred", "weight": 1},
{"activated": True, "id": 2, "name": "jeanne", "weight": 1},
],
"amount": 25.0,
"date": "2011-08-10",
Expand Down Expand Up @@ -498,7 +498,7 @@ def test_bills(self):
"payer_id": 2,
"owers": [
{"activated": True, "id": 1, "name": "zorglub", "weight": 1},
{"activated": True, "id": 2, "name": "fred", "weight": 1},
{"activated": True, "id": 2, "name": "jeanne", "weight": 1},
],
"amount": 25.0,
"date": "2011-09-10",
Expand Down Expand Up @@ -534,7 +534,7 @@ def test_bills_with_calculation(self):

# add participants
self.api_add_member("raclette", "zorglub")
self.api_add_member("raclette", "fred")
self.api_add_member("raclette", "jeanne")

# valid amounts
input_expected = [
Expand Down Expand Up @@ -576,7 +576,7 @@ def test_bills_with_calculation(self):
"payer_id": 1,
"owers": [
{"activated": True, "id": 1, "name": "zorglub", "weight": 1},
{"activated": True, "id": 2, "name": "fred", "weight": 1},
{"activated": True, "id": 2, "name": "jeanne", "weight": 1},
],
"amount": expected_amount,
"date": "2011-08-10",
Expand Down Expand Up @@ -647,7 +647,7 @@ def test_currencies(self):

# Add participants
self.api_add_member("raclette", "zorglub")
self.api_add_member("raclette", "fred")
self.api_add_member("raclette", "jeanne")
self.api_add_member("raclette", "quentin")

# Add a bill without explicit currency
Expand Down Expand Up @@ -680,7 +680,7 @@ def test_currencies(self):
"payer_id": 1,
"owers": [
{"activated": True, "id": 1, "name": "zorglub", "weight": 1},
{"activated": True, "id": 2, "name": "fred", "weight": 1},
{"activated": True, "id": 2, "name": "jeanne", "weight": 1},
],
"amount": 25.0,
"date": "2011-08-10",
Expand Down Expand Up @@ -725,7 +725,7 @@ def test_currencies(self):
"payer_id": 1,
"owers": [
{"activated": True, "id": 1, "name": "zorglub", "weight": 1.0},
{"activated": True, "id": 2, "name": "fred", "weight": 1.0},
{"activated": True, "id": 2, "name": "jeanne", "weight": 1.0},
],
"amount": 30.0,
"date": "2011-08-10",
Expand Down Expand Up @@ -781,7 +781,7 @@ def test_statistics(self):

# add participants
self.api_add_member("raclette", "zorglub")
self.api_add_member("raclette", "fred")
self.api_add_member("raclette", "jeanne")

# add a bill
req = self.client.post(
Expand Down Expand Up @@ -818,7 +818,7 @@ def test_statistics(self):
"member": {
"activated": True,
"id": 2,
"name": "fred",
"name": "jeanne",
"weight": 1.0,
},
"paid": 0,
Expand All @@ -844,7 +844,7 @@ def test_weighted_bills(self):

# add participants
self.api_add_member("raclette", "zorglub")
self.api_add_member("raclette", "freddy familly", 4)
self.api_add_member("raclette", "jeannedy familly", 4)
self.api_add_member("raclette", "quentin")

# add a bill
Expand Down Expand Up @@ -875,7 +875,7 @@ def test_weighted_bills(self):
"payer_id": 1,
"owers": [
{"activated": True, "id": 1, "name": "zorglub", "weight": 1},
{"activated": True, "id": 2, "name": "freddy familly", "weight": 4},
{"activated": True, "id": 2, "name": "jeannedy familly", "weight": 4},
],
"amount": 25.0,
"date": "2011-08-10",
Expand Down Expand Up @@ -909,7 +909,7 @@ def test_weighted_bills(self):
{
"activated": True,
"id": 2,
"name": "freddy familly",
"name": "jeannedy familly",
"weight": 4.0,
"balance": -20.0,
},
Expand Down
Loading

0 comments on commit aab32a2

Please sign in to comment.