Skip to content

Commit

Permalink
Add commentaries about the match_json function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kutu committed Jan 17, 2024
1 parent e57385c commit 803846d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,17 @@ def inner(
if key not in mocked_data:
continue

# TODO This is prone to error with objects and lists inside the value
# TODO Maybe this function should be tested as well ;)

# When the passed value is a list different checks should be made,
# this happens when the same parameters is in the request multiple times,
# this happens for example when using
# the parameter "songId" in the endpoint "createPlaylist".
if (
type(value) is list
and type(mocked_data[key]) is str
and (
mocked_data[key] in value
# The values inside the list "value" can sometimes be integers,
# so a extra check is needed for them.
or (
str.isdigit(mocked_data[key]) and int(mocked_data[key]) in value
)
Expand Down

0 comments on commit 803846d

Please sign in to comment.