Skip to content

Commit

Permalink
🐛 Fix bug in update_organization and refactor test (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejsdev authored Apr 15, 2024
1 parent aa8e0c1 commit edcb055
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions backend/app/api/routes/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def update_organization(
update_dict = organization_in.model_dump(exclude_unset=True)
org = link.organization
org.sqlmodel_update(update_dict)
session.add(org)
session.commit()
return org


Expand Down
5 changes: 3 additions & 2 deletions backend/app/tests/api/routes/test_organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def test_update_organization(client: TestClient, db: Session) -> None:

assert response.status_code == 200
data = response.json()
db.refresh(organization)
assert data["id"] == organization.id
assert data["name"] == organization_in["name"]
assert data["description"] == organization_in["description"]
assert organization.name == organization_in["name"]
assert organization.description == organization_in["description"]


def test_update_organization_not_found(client: TestClient) -> None:
Expand Down

0 comments on commit edcb055

Please sign in to comment.