Add test for recently added helper
This commit is contained in:
parent
0dea216851
commit
d243017aff
1 changed files with 21 additions and 0 deletions
21
tests/test_helpers.py
Normal file
21
tests/test_helpers.py
Normal file
|
@ -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'
|
Loading…
Reference in a new issue