Completed
Push — ensure-repos-have-context ( 1b481e...efbf96 )
by Michael
01:25
created

test_local_repo_typo()   A

Complexity

Conditions 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
1
# -*- coding: utf-8 -*-
2
from cookiecutter import repository, exceptions
3
4
import pytest
5
6
7
def test_finds_local_repo():
8
    """A valid local repository should be returned."""
9
    project_dir = repository.determine_repo_dir(
10
        'tests/fake-repo',
11
        abbreviations={},
12
        clone_to_dir=None,
13
        checkout=None,
14
        no_input=True
15
    )
16
17
    assert 'tests/fake-repo' == project_dir
18
19
20
def test_local_repo_with_no_context_raises():
21
    """A local repository without a cookiecutter.json should raise a
22
    `RepositoryNotFound` exception.
23
    """
24
    with pytest.raises(exceptions.RepositoryNotFound):
25
        repository.determine_repo_dir(
26
            'tests/fake-repo-bad',
27
            abbreviations={},
28
            clone_to_dir=None,
29
            checkout=None,
30
            no_input=True
31
        )
32
33
34
def test_local_repo_typo():
35
    """An unknown local repository should raise a `RepositoryNotFound`
36
    exception.
37
    """
38
    with pytest.raises(exceptions.RepositoryNotFound):
39
        repository.determine_repo_dir(
40
            'tests/unknown-repo',
41
            abbreviations={},
42
            clone_to_dir=None,
43
            checkout=None,
44
            no_input=True
45
        )
46