Skip to content
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

Refactor parser and downloader tests #9

Merged
merged 16 commits into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
fbbb8e3
test(parser): :recycle: Add fixtures for returning mock paths and tex…
hotenov Nov 9, 2021
af8ee3a
test(parser): :white_check_mark: Update parser tests with using fixtu…
hotenov Nov 9, 2021
42ad947
test(parser): :white_check_mark: Update tests with new fixtures for p…
hotenov Nov 11, 2021
14c9e7b
chore: :wrench: Add LOCAL_JSON_DB constant in config.py
hotenov Nov 11, 2021
60b95e1
test(parser): :white_check_mark: Add fixtures for mocking JSON db and…
hotenov Nov 11, 2021
4769f66
test(parser): :white_check_mark: Add fixture with requests.Session an…
hotenov Nov 11, 2021
16e66d1
style(parser): :art: Format code with max line length = 80 (ignore in…
hotenov Nov 11, 2021
2b491cc
chore: :arrow_up: Update typeguard (2.12.1 -> 2.13.0)
hotenov Nov 17, 2021
8bac025
test: Move package's imports to fixtures defenitions (to fix typeguar…
hotenov Nov 17, 2021
0fab718
test(parser): :recycle: Add fixtures with parsing mocked results
hotenov Nov 19, 2021
a652afa
test(parser): :white_check_mark: Update parsing archive tests with ne…
hotenov Nov 19, 2021
6e68f5f
test(parser): :recycle: Add fixture with temp direcory for pytest ses…
hotenov Nov 20, 2021
00ca932
test(downloader): :recycle: Update tests with built-in 'tmp_path' fix…
hotenov Nov 20, 2021
29ce393
test(downloader): :recycle: Add fixtures to mock mp3 files and update…
hotenov Nov 21, 2021
3fade55
test(downloader): :recycle: Add fixtures to mock different extraction…
hotenov Nov 21, 2021
7bceb20
test(parser): :white_check_mark: Add test to check skipping non-episo…
hotenov Nov 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 43 additions & 12 deletions src/lep_downloader/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# MIT License
#
# Copyright (c) 2021 Artem Hotenov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""App configuration module."""


Expand All @@ -6,23 +27,33 @@
JSON_DB_URL = "https://hotenov.com/some_json.json"

LOCAL_ARCHIVE_HTML = "2021-08-10_lep-archive-page-content-pretty.html"
LOCAL_JSON_DB = "mocked-db-json-equal-786-objects.json"

# yapf: disable
SHORT_LINKS_MAPPING_DICT = {
"http://wp.me/p4IuUx-7PL": "https://teacherluke.co.uk/2017/06/20/460-catching-up-with-amber-paul-6-feat-sarah-donnelly/",
"http://wp.me/p4IuUx-7C6": "https://teacherluke.co.uk/2017/04/25/444-the-rick-thompson-report-snap-general-election-2017/",
"http://wp.me/p4IuUx-7C4": "https://teacherluke.co.uk/2017/04/21/443-the-trip-to-japan-part-2/",
"http://wp.me/p4IuUx-7BQ": "https://teacherluke.co.uk/2017/04/21/442-the-trip-to-japan-part-1/",
"http://wp.me/p4IuUx-7BO": "https://teacherluke.co.uk/2017/04/18/441-andy-johnson-at-the-iatefl-conference/",
"http://wp.me/p4IuUx-7Av": "https://teacherluke.co.uk/2017/03/28/436-the-return-of-the-lying-game-with-amber-paul-video/",
"http://wp.me/p4IuUx-7zK": "https://teacherluke.co.uk/2017/03/26/i-was-interviewed-on-my-fluent-podcast-with-daniel-goodson/",
"http://wp.me/p4IuUx-7sg": "https://teacherluke.co.uk/2017/01/10/415-with-the-family-part-3-more-encounters-with-famous-people/",
"https://wp.me/p4IuUx-29": "https://teacherluke.co.uk/2011/10/11/notting-hill-carnival-video-frustration-out-takes/",
"http://wp.me/p4IuUx-7PL":
"https://teacherluke.co.uk/2017/06/20/460-catching-up-with-amber-paul-6-feat-sarah-donnelly/", # noqa: E501,B950
"http://wp.me/p4IuUx-7C6":
"https://teacherluke.co.uk/2017/04/25/444-the-rick-thompson-report-snap-general-election-2017/", # noqa: E501,B950
"http://wp.me/p4IuUx-7C4":
"https://teacherluke.co.uk/2017/04/21/443-the-trip-to-japan-part-2/",
"http://wp.me/p4IuUx-7BQ":
"https://teacherluke.co.uk/2017/04/21/442-the-trip-to-japan-part-1/",
"http://wp.me/p4IuUx-7BO":
"https://teacherluke.co.uk/2017/04/18/441-andy-johnson-at-the-iatefl-conference/", # noqa: E501,B950
"http://wp.me/p4IuUx-7Av":
"https://teacherluke.co.uk/2017/03/28/436-the-return-of-the-lying-game-with-amber-paul-video/", # noqa: E501,B950
"http://wp.me/p4IuUx-7zK":
"https://teacherluke.co.uk/2017/03/26/i-was-interviewed-on-my-fluent-podcast-with-daniel-goodson/", # noqa: E501,B950
"http://wp.me/p4IuUx-7sg":
"https://teacherluke.co.uk/2017/01/10/415-with-the-family-part-3-more-encounters-with-famous-people/", # noqa: E501,B950
"https://wp.me/p4IuUx-29":
"https://teacherluke.co.uk/2011/10/11/notting-hill-carnival-video-frustration-out-takes/", # noqa: E501,B950
}

# MISSPELLED_LTD = ".co.ukm"
# yapf: enable

IRRELEVANT_LINKS = ("https://wp.me/P4IuUx-82H",)

EPISODE_LINK_RE = r"https?://((?P<short>wp\.me/p4IuUx-[\w-]+)|(teacherluke\.(co\.uk|wordpress\.com)/(?P<date>\d{4}/\d{2}/\d{2})/))"
EPISODE_LINK_RE = r"https?://((?P<short>wp\.me/p4IuUx-[\w-]+)|(teacherluke\.(co\.uk|wordpress\.com)/(?P<date>\d{4}/\d{2}/\d{2})/))" # noqa: E501,B950

INVALID_PATH_CHARS_RE = r"[<>:\"/\\\\|?*]"
Loading