|
1
|
|
|
#!/usr/bin/env python |
|
2
|
|
|
# -*- coding: utf-8 -*- |
|
3
|
|
|
# Apache Software License 2.0 |
|
4
|
|
|
# |
|
5
|
|
|
# Copyright (c) 2018, Christophe Duong |
|
6
|
|
|
# |
|
7
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
|
8
|
|
|
# you may not use this file except in compliance with the License. |
|
9
|
|
|
# You may obtain a copy of the License at |
|
10
|
|
|
# |
|
11
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
|
12
|
|
|
# |
|
13
|
|
|
# Unless required by applicable law or agreed to in writing, software |
|
14
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
|
15
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16
|
|
|
# See the License for the specific language governing permissions and |
|
17
|
|
|
# limitations under the License. |
|
18
|
|
|
"""Tests for `aiscalator` package.""" |
|
19
|
|
|
|
|
20
|
|
|
from click.testing import CliRunner |
|
21
|
|
|
|
|
22
|
|
|
from aiscalator import cli |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
def test_cli_help_version(): |
|
26
|
|
|
"""Test the CLI --help and --version.""" |
|
27
|
|
|
cli_tests = [ |
|
28
|
|
|
[], |
|
29
|
|
|
['--help'], |
|
30
|
|
|
['--version'], |
|
31
|
|
|
['version'], |
|
32
|
|
|
['airflow'], |
|
33
|
|
|
['airflow', '--help'], |
|
34
|
|
|
['airflow', '--version'], |
|
35
|
|
|
['airflow', "new", '--help'], |
|
36
|
|
|
['airflow', "run", '--help'], |
|
37
|
|
|
['airflow', "edit", '--help'], |
|
38
|
|
|
['airflow', "setup", '--help'], |
|
39
|
|
|
['airflow', "push", '--help'], |
|
40
|
|
|
['airflow', "start", '--help'], |
|
41
|
|
|
['airflow', "stop", '--help'], |
|
42
|
|
|
['jupyter'], |
|
43
|
|
|
['jupyter', '--help'], |
|
44
|
|
|
['jupyter', '--version'], |
|
45
|
|
|
['jupyter', "new", '--help'], |
|
46
|
|
|
['jupyter', "run", '--help'], |
|
47
|
|
|
['jupyter', "edit", '--help'], |
|
48
|
|
|
['jupyter', "setup", '--help'], |
|
49
|
|
|
['setup'], |
|
50
|
|
|
['setup', '--help'], |
|
51
|
|
|
['setup', '--version'], |
|
52
|
|
|
['cookiecutter'], |
|
53
|
|
|
['cookiecutter', '--help'], |
|
54
|
|
|
['cookiecutter', '--version'], |
|
55
|
|
|
] |
|
56
|
|
|
runner = CliRunner() |
|
57
|
|
|
print() |
|
58
|
|
|
for test in cli_tests: |
|
59
|
|
|
msg = "Testing CLI with: " + " ".join(test) + " => " |
|
60
|
|
|
result = runner.invoke(cli.main, test) |
|
61
|
|
|
print(msg + str(result.exit_code)) |
|
62
|
|
|
assert result.exit_code == 0 |
|
63
|
|
|
|