fix: changed order of required parameters

This commit is contained in:
Ewen 2024-05-09 07:42:43 +02:00
parent 94547f2031
commit bac9a576ee
2 changed files with 6 additions and 5 deletions

View file

@ -40,12 +40,13 @@ def parse_page():
if not args.get("url"): if not args.get("url"):
raise InvalidParameters("Missing parameter: URL") raise InvalidParameters("Missing parameter: URL")
if not args.get("title"):
raise InvalidParameters("Missing parameter: title")
if not args.get("article"): if not args.get("article"):
raise InvalidParameters("Missing parameter: article") raise InvalidParameters("Missing parameter: article")
if not args.get("title"):
raise InvalidParameters("Missing parameter: title")
# Checking for correctness # Checking for correctness
if not args.get("url").startswith("https"): if not args.get("url").startswith("https"):
args["url"] = "https://" + args.get("url") args["url"] = "https://" + args.get("url")

View file

@ -5,8 +5,8 @@ import pytest
"url,missing_parameter", "url,missing_parameter",
[ [
("/feed/", "URL"), ("/feed/", "URL"),
("/feed/?url=https://mozilla.org", "title"), ("/feed/?url=https://mozilla.org", "article"),
("/feed/?url=https://mozilla.org&title=h2", "article"), ("/feed/?url=https://mozilla.org&article=article", "title"),
("/feed/?url=https://mozilla.org&title=h2&article=article", None), ("/feed/?url=https://mozilla.org&title=h2&article=article", None),
], ],
) )