#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Testing berhoel.django.media_ooimport.console._helper.
"""
# Third party libraries.
import pytest
from berhoel.django.media_ooimport.console import _helper
__date__ = "2020/05/03 18:26:29 hoel"
__author__ = "Berthold Höllmann"
__copyright__ = "Copyright © 2020 by Berthold Höllmann"
__credits__ = ["Berthold Höllmann"]
__maintainer__ = "Berthold Höllmann"
__email__ = "berhoel@gmail.com"
[docs]@pytest.mark.parametrize(
"test_input, url_ref, title_ref",
[
[
'of:=HYPERLINK("http://www.imdb.com/title/tt0094612/";"Action Jackson")',
"http://www.imdb.com/title/tt0094612",
"Action Jackson",
],
[
'of:=HYPERLINK( "http://www.imdb.com/title/tt0094612/" ; "Action Jackson")',
"http://www.imdb.com/title/tt0094612",
"Action Jackson",
],
[
'of:=HYPERLINK("http://www.imdb.com/title/tt3375370";"The Gunfighter (2014)" )',
"http://www.imdb.com/title/tt3375370",
"The Gunfighter (2014)",
],
[
'of:=HYPERLINK("https://www.imdb.com/title/tt0055205/?ref_=nv_sr_1";"16 Uhr 50 ab Paddington (1961)")',
"https://www.imdb.com/title/tt0055205",
"16 Uhr 50 ab Paddington (1961)",
],
[
'of:=HYPERLINK("https://www.imdb.com/title/tt0043265/?ref_=fn_al_tt_2";"African Queen (1951)")',
"https://www.imdb.com/title/tt0043265",
"African Queen (1951)",
],
[
'of:=HYPERLINK("https://www.imdb.com/title/tt1299368/?ref_=tt_ov_inf";"Southland")',
"https://www.imdb.com/title/tt1299368",
"Southland",
],
[
'of:=HYPERLINK("http://www.imdb.com/title/tt2621446?ref_=tt_ov_inf";"Star Trek: Renegades")',
"http://www.imdb.com/title/tt2621446",
"Star Trek: Renegades",
],
[
'of:=HYPERLINK("http://www.imdb.com/title/tt0284718/episodes";"Crossing Jordan")',
"http://www.imdb.com/title/tt0284718",
"Crossing Jordan",
],
],
)
def test_indb_hyperlink(test_input, url_ref, title_ref):
match = _helper.IMDB_HYPERLINK.match(test_input)
title, url = match.group("name"), match.group("url")
assert url == url_ref
assert title == title_ref
[docs]@pytest.mark.parametrize(
"test_input, val_ref", [["of:=-['k&v'.F207]", "207"], ["of:=-[$'k&v'.F207]", "207"]]
)
def test_dvd_link(test_input, val_ref):
match = _helper.DVD_LINK.match(test_input)
val = match.group("line")
assert val == val_ref
# Local Variables:
# mode: python
# compile-command: "poetry run tox"
# time-stamp-pattern: "30/__date__ = \"%:y/%02m/%02d %02H:%02M:%02S %u\""
# End: