コード例 #1
0
def test_version(capsys):
    """Ensure version exists and properly formatted
    """
    with pytest.raises(SystemExit):
        main(['--version'])
    out, err = capsys.readouterr()
    assert re.compile("^dcos-launch \d+\.\d+\.\d+$").match(out) is not None
コード例 #2
0
def test_noop():
    """Ensure docopt exit (displays usage)
    """
    with pytest.raises(DocoptExit):
        main([])
    with pytest.raises(DocoptExit):
        main(['foobar'])
コード例 #3
0
def test_conflicting_path(tmpdir, aws_cf_config_path):
    """Ensure default cluster info path is never overwritten
    by launching successive clusters
    """
    with tmpdir.as_cwd():
        shutil.copyfile(aws_cf_config_path, str(tmpdir.join('config.yaml')))
        assert main(['create']) == 0
        assert main(['create']) == 1
コード例 #4
0
def test_no_files_specified(tmpdir, aws_cf_config_path):
    """Ensure typical usage works without specifying config and info file paths
    """
    with tmpdir.as_cwd():
        shutil.copyfile(aws_cf_config_path, str(tmpdir.join('config.yaml')))
        assert main(['create']) == 0
        assert main(['wait']) == 0
        assert main(['describe']) == 0
        assert main(['pytest']) == 0
        assert main(['delete']) == 0
コード例 #5
0
def test_missing_input(tmpdir):
    """No files are provided so any operation should fail
    """
    with tmpdir.as_cwd():
        for cmd in ['create', 'wait', 'describe', 'delete', 'pytest']:
            assert main([cmd]) == 1