From d243017affa1397a8a08f34b3c1a01177f6f315e Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Mon, 28 Oct 2019 19:17:57 +0100 Subject: [PATCH] Add test for recently added helper --- tests/test_helpers.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_helpers.py diff --git a/tests/test_helpers.py b/tests/test_helpers.py new file mode 100644 index 000000000..8ded2826b --- /dev/null +++ b/tests/test_helpers.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2019 Tobias Gruetzmacher + +from __future__ import absolute_import, division, print_function + +import pytest +import re +from dosagelib.helpers import joinPathPartsNamer + + +class TestNamer(object): + """ + Tests for comic namer. + """ + + def test_joinPathPartsNamer(self): + imgurl = 'https://HOST/wp-content/uploads/2019/02/tennis5wp-1.png' + pageurl = 'https://HOST/2019/03/11/12450/' + assert joinPathPartsNamer((0, 1, 2))(self, imgurl, pageurl) == '2019_03_11_tennis5wp-1.png' + assert joinPathPartsNamer((0, 1, 2), (-1,), '-')(self, imgurl, pageurl) == '2019-03-11-tennis5wp-1.png' + assert joinPathPartsNamer((0, -2), ())(self, imgurl, pageurl) == '2019_12450'