Skip to content

Commit

Permalink
Add test on PATCH for account entrypoint
Browse files Browse the repository at this point in the history
Related to #80
  • Loading branch information
sebastienbarbier committed May 5, 2023
1 parent c3ce4bd commit e0a6437
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 17 additions & 0 deletions seven23/api/accounts/tests_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ def test_account_post(self):
assert response.status_code == status.HTTP_200_OK
assert response.json()['name'] == 'Test creation'

def test_account_patch(self):
"""
We try to edit an account object
"""
self.client.force_authenticate(user=self.user)

response = self.client.get('/api/v1/accounts/%d' % self.account.id)
assert response.status_code == status.HTTP_200_OK

assert self.account.name == "Private Account"
self.account.name = "Public Account"
response = self.client.patch('/api/v1/accounts/%d' % self.account.id,
{'name': self.account.name,
})
assert response.status_code == status.HTTP_200_OK
assert response.json()['name'] == "Public Account"

def test_account_destroy(self):
"""
We try to edit an account object
Expand Down
1 change: 0 additions & 1 deletion seven23/models/accounts/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from seven23.models.accounts.models import Account, AccountGuests
from seven23.models.currency.models import Currency


from rest_framework_bulk import (
BulkListSerializer,
BulkSerializerMixin
Expand Down

0 comments on commit e0a6437

Please sign in to comment.