Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
user tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRut committed Sep 10, 2021
1 parent 9c2a2cb commit f4dbcfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pygrocy/grocy_api_client.py
Expand Up @@ -509,12 +509,12 @@ def get_meal_plan_section(self, meal_plan_section_id) -> MealPlanSectionResponse
def get_users(self) -> List[UserDto]:
parsed_json = self._do_get_request("users")
if parsed_json:
return [UserDto(user) for user in parsed_json]
return [UserDto(**user) for user in parsed_json]

def get_user(self, id: int) -> UserDto:
query_params = []
if id:
query_params.append(f"id={id}")
parsed_json = self._do_get_request("users")
if parsed_json:
return UserDto(parsed_json[0])
return UserDto(**parsed_json[0])
2 changes: 2 additions & 0 deletions test/test_users.py
Expand Up @@ -9,6 +9,8 @@ def test_get_user_by_id_valid(self, grocy):
user = grocy.user(id=1)
assert isinstance(user, User)
assert user.id == 1
assert user.display_name == "Demo User"
assert user.username == "Demo User"

@pytest.mark.vcr
def test_get_users_valid(self, grocy):
Expand Down

0 comments on commit f4dbcfc

Please sign in to comment.