File: test_settings.py

package info (click to toggle)
elasticsearch-curator 8.0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,716 kB
  • sloc: python: 17,838; makefile: 159; sh: 156
file content (24 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Unit testing for helpers.creators functions"""
from unittest import TestCase
import pytest
from curator.defaults.settings import CURATOR_DOCS, footer
from curator.exceptions import CuratorException
from curator._version import __version__

class TestFooter(TestCase):
    """Test defaults.settings.footer functionality."""
    mytail = 'tail.html'
    ver = __version__.split('.')
    majmin = f'{ver[0]}.{ver[1]}'
    def test_basic_functionality(self):
        """Should return a URL with the major/minor version in the path"""
        expected = f'Learn more at {CURATOR_DOCS}/{self.majmin}/{self.mytail}'
        assert expected == footer(__version__, tail=self.mytail)
    def test_raises_with_nonstring(self):
        """Should raise an exception if a non-string value is passed as version"""
        with pytest.raises(CuratorException):
            footer(1234)
    def test_raises_with_unsplittable_string(self):
        """Should raise an exception if a non-period delimited string value is passed as version"""
        with pytest.raises(CuratorException):
            footer('invalid')