Completed
Pull Request — develop (#5)
by Jace
09:05
created

describe_new()   A

Complexity

Conditions 2

Size

Total Lines 7

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 7
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
                ".gitignore",  # ignore /tmp
45
                "docs/index.html",  # example HTML file using `osmerge.geojson`
46
                "docs/osmerge.geojson",  # copied from `tmp/merged.geojson`
47
                "osmerge.csv",  # data set
48
                "osmerge.yml",  # config file
49
                "tmp/base.json",  # downloaded OSM data
50
                "tmp/filtered.json",  # reduced data based on config filters
51
                "tmp/merged.geojson "  # above file converted to GeoJSON
52
                "tmp/merged.json",  # above file with added fields
53
            ]
54