-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add tests to codebase #116
Conversation
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 2.87%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Ok there are two options here, i'm not sure which to go with as there are pros and cons to both:
For the DBs, I think creating a subfolder in tests would allow easy access for the above methods just having to copy it over to the correct directory. |
In this situation, we should probably use option 2 to install the |
I have used the So based on that, there would only be so much of Pyarr that could be tested against the live arr servers, the rest would still need to be mocked. |
Given that we're an API for download grabbers (the |
Worst case we can go back to static fixtures, but that risks being out of sync with -arr APIs. There has been occasions where they have made breaking API changes with no warning. |
I think to start with maybe static fixtures until i can figure a way to do everything needed for using the full clients, or maybe do a mix of both, where it's too complex to use the Arr instance we use the static ones instead. I know it's not ideal but it will allow moving forwards. |
I say just use static fixtures for everything to move things forward. Until we develop live testing, we'll just have to remember to manually update the static fixtures every so often. |
Ok @Archmonger I think this is ready to merge, All tests that can be are doing it against the live APIs, the rest are still mocks. I haven't got 100% coverage yet, but its all around 90% or more, which at the moment I think is enough to get this merged, test the new github actions and resolve any issues related before pushing to PyPi |
Description
Adding tests to the codebase, this should reduce the number of bugs introduced during changes.
Related issues
Motivation and Context
Too many issues / bugs being introduced on each release which is not ideal
How has this been tested
Change List
nox
for testing and updated github workflows to matchsort_key
andsort_dir
implementation
argument toget_notification_schema
to allow selection of a single implementationget_import_list_schema
add_import_list
upd_config_download_client
add_notification
id_
toget_root_folder
get_command
get_queue
updated to include additional argumentsget_parse_title_path
lookup_series
add_root_folder
get_language_profile
,upd_language_profile
,del_language_profile
,get_language_profile_schema
get_episode_file
updated to allow filter by series idadd_root_folder
lookup
to search for books and authorsadd_release_profile
add_delay_profile
get_calendar
changed to requiredatetime
object for date argumentsget_history
updated to allow additional options inSonarrAPI
SonarrSortKeys
Enum namingget_episode_files_by_series_id
lookup_series_by_tvdb_id
get_parsed_title
get_parsed_path
db_id
toid_
to align rest of APIlookup_movie_by_imdb_id
lookup_movie_by_tmdb_id
upd_movies
updated to show examples of usageget_movie_file
now able to get multiple movie filesget_movie_files
removed as this would not work useget_movie_file
insteaddel_movie
now able to delete multiple movie filesdel_movies
add_root_folder
arguments re-arrangedadd_artist
andadd_album
changed from usingsearch_term
to usingid_
(musicbrainz ID) for more predictable results where multiple search items could have previously been returnedget_wanted
updated to be more efficient, options moved to match ordering of other methodsget_queue
updated to be more efficient, options moved to match ordering of other methodsget_queue_details
updated to be more efficientget_tracks
if no ids suppliedget_track_file
if no ids suppliedget_metadata_profile
to use correct returnget_missing
updated to be more efficient, options moved to match ordering of other methodsget_cutoff
updated to be more efficient, options moved to match ordering of other methodsget_queue
updated to be more efficient, options moved to match ordering of other methodsadd_author
updatedsearch_term
to matchterm
formatadd_quality_profile
language_profile_id
toadd_series
get_quality_profile
inherits frombase
upd_tag
incorrect url pathadd_series
changed to remove the use of the_series_json
method, now supply a series result fromlookup()
this also allows more control without Pyarr selecting the first lookup result.get_movie
tmdb not working fixes Type issues withRadarrAPI.get_movie()
#119add_quality_profile
changed to have additional variables over other Arr'sadd_book
changed to remove the use of the_book_json
method, now supply a book result fromlookup()
this also allows more control without Pyarr selecting the first lookup result.add_album
changed to remove the use of the_book_json
method, now supply a book result fromlookup()
this also allows more control without Pyarr selecting the first lookup result.get_album
incorrect assertion when returning list or dictalbumId
not working withinget_release
method