Completed
Pull Request — develop (#5)
by Jace
02:26
created

it_generates_a_sample_project()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
1
# pylint: disable=unused-variable,expression-not-assigned,redefined-outer-name
2
3
import sys
4
5
import pytest
6
import scripttest
7
from expecter import expect
8
9
10
@pytest.fixture
11
def env(tmpdir):
12
    path = str(tmpdir.join("test"))
13
    env = scripttest.TestFileEnvironment(path)
14
    return env
15
16
17
@pytest.fixture
18
def cli(env):
19
    prog = sys.executable, '-m', 'osmerge'
20
    return lambda *args: env.run(*prog, *args, expect_error=True)
0 ignored issues
show
introduced by
invalid syntax
Loading history...
21
22
23
def describe_cli():
24
25
    def it_displays_help_information(cli):
26
        cmd = cli('--help')
27
28
        expect(cmd.returncode) == 0
29
        expect(cmd.stdout).contains("Usage: ")
30
31
    def it_displays_version_information(cli):
32
        cmd = cli('--version')
33
34
        expect(cmd.returncode) == 0
35
        expect(cmd.stdout or cmd.stderr).contains("OSMerge v0.")
36
37
    def describe_new():
38
39
        def it_generates_a_sample_project(cli):
40
            cmd = cli('new')
41
42
            expect(cmd.returncode) == 0
43
            expect(sorted(cmd.files_created.keys())) == [
44
                # TODO: figure out why .gitignore isn't showing up
45
                # ".gitignore",  # ignore /tmp
46
                "Makefile",  # builds the pipeline
47
                "docs",
48
                "docs/index.html",  # example HTML file using `osmerge.geojson`
49
                "docs/osmerge.geojson",  # converted from `tmp/merged.json`
50
                "osmerge.csv",  # data set
51
                "osmerge.yml",  # config file
52
            ]
53