Completed
Push — extra-context-cli ( af51e0...e7614b )
by Michael
01:02
created

tests.test_jinja2_time_extension()   B

Complexity

Conditions 4

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 4
dl 0
loc 22
rs 8.9197
1
# -*- coding: utf-8 -*-
2
3
import os
4
import io
5
6
import pytest
7
import freezegun
8
9
from cookiecutter.main import cookiecutter
10
11
12
@pytest.yield_fixture(autouse=True)
13
def freeze():
14
    freezer = freezegun.freeze_time("2015-12-09 23:33:01")
15
    freezer.start()
16
    yield
17
    freezer.stop()
18
19
20
def test_jinja2_time_extension(tmpdir):
21
    project_dir = cookiecutter(
22
        'tests/test-extensions/default/',
23
        no_input=True,
24
        output_dir=str(tmpdir)
25
    )
26
    changelog_file = os.path.join(project_dir, 'HISTORY.rst')
27
    assert os.path.isfile(changelog_file)
28
29
    with io.open(changelog_file, 'r', encoding='utf-8') as f:
30
        changelog_lines = f.readlines()
31
32
    expected_lines = [
33
        'History\n',
34
        '-------\n',
35
        '\n',
36
        '0.1.0 (2015-12-09)\n',
37
        '---------------------\n',
38
        '\n',
39
        'First release on PyPI.\n'
40
    ]
41
    assert expected_lines == changelog_lines
42