-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tamarrow
committed
Apr 14, 2016
1 parent
bd90576
commit 56a8690
Showing
15 changed files
with
145 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
|
||
import pytest | ||
|
||
from .common import assert_command, config_set, config_unset, exec_command | ||
from .common import (assert_command, config_set, config_unset, | ||
exec_command, update_config) | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -20,17 +21,6 @@ def env(): | |
return r | ||
|
||
|
||
@pytest.fixture | ||
def missing_env(): | ||
r = os.environ.copy() | ||
r.update({ | ||
constants.PATH_ENV: os.environ[constants.PATH_ENV], | ||
constants.DCOS_CONFIG_ENV: | ||
os.path.join("tests", "data", "config", "missing_params_dcos.toml") | ||
}) | ||
return r | ||
|
||
|
||
def test_help(): | ||
with open('tests/data/help/config.txt') as content: | ||
assert_command(['dcos', 'config', '--help'], | ||
|
@@ -80,13 +70,15 @@ def test_invalid_dcos_url(env): | |
stderr = b'Please check url \'abc.com\'. Missing http(s)://\n' | ||
assert_command(['dcos', 'config', 'set', 'core.dcos_url', 'abc.com'], | ||
stderr=stderr, | ||
returncode=1) | ||
returncode=1, | ||
env=env) | ||
|
||
|
||
def test_get_top_property(env): | ||
stderr = ( | ||
b"Property 'core' doesn't fully specify a value - " | ||
b"possible properties are:\n" | ||
b"core.dcos_acs_token\n" | ||
b"core.dcos_url\n" | ||
b"core.reporting\n" | ||
b"core.ssl_verify\n" | ||
|
@@ -95,18 +87,19 @@ def test_get_top_property(env): | |
|
||
assert_command(['dcos', 'config', 'show', 'core'], | ||
stderr=stderr, | ||
returncode=1) | ||
returncode=1, | ||
env=env) | ||
|
||
|
||
def test_set_package_sources_property(env): | ||
def test_set_package_sources_property(): | ||
notice = (b"This config property has been deprecated. " | ||
b"Please add your repositories with `dcos package repo add`\n") | ||
assert_command(['dcos', 'config', 'set', 'package.sources', '[\"foo\"]'], | ||
stderr=notice, | ||
returncode=1) | ||
|
||
|
||
def test_set_core_email_property(env): | ||
def test_set_core_email_property(): | ||
notice = (b"This config property has been deprecated.\n") | ||
assert_command(['dcos', 'config', 'set', 'core.email', '[email protected]'], | ||
stderr=notice, | ||
|
@@ -189,6 +182,7 @@ def test_unset_top_property(env): | |
stderr = ( | ||
b"Property 'core' doesn't fully specify a value - " | ||
b"possible properties are:\n" | ||
b"core.dcos_acs_token\n" | ||
b"core.dcos_url\n" | ||
b"core.reporting\n" | ||
b"core.ssl_verify\n" | ||
|
@@ -216,10 +210,10 @@ def test_set_property_key(env): | |
env=env) | ||
|
||
|
||
def test_set_missing_property(missing_env): | ||
config_set('core.dcos_url', 'http://localhost:8080', missing_env) | ||
_get_value('core.dcos_url', 'http://localhost:8080', missing_env) | ||
config_unset('core.dcos_url', missing_env) | ||
def test_set_missing_property(env): | ||
with update_config("core.dcos_url", None, env=env): | ||
config_set('core.dcos_url', 'http://localhost:8080', env) | ||
_get_value('core.dcos_url', 'http://localhost:8080', env) | ||
|
||
|
||
def test_set_core_property(env): | ||
|
@@ -272,19 +266,15 @@ def test_bad_port_fail_url_validation(env): | |
'http://localhost:bad_port/', env) | ||
|
||
|
||
def test_timeout(missing_env): | ||
config_set('marathon.url', 'http://1.2.3.4', missing_env) | ||
config_set('core.timeout', '1', missing_env) | ||
|
||
returncode, stdout, stderr = exec_command( | ||
['dcos', 'marathon', 'app', 'list'], env=missing_env) | ||
|
||
assert returncode == 1 | ||
assert stdout == b'' | ||
assert "(connect timeout=1)".encode('utf-8') in stderr | ||
def test_timeout(env): | ||
with update_config('marathon.url', 'http://1.2.3.4', env): | ||
with update_config('core.timeout', '1', env): | ||
returncode, stdout, stderr = exec_command( | ||
['dcos', 'marathon', 'app', 'list'], env=env) | ||
|
||
config_unset('core.timeout', missing_env) | ||
config_unset('marathon.url', missing_env) | ||
assert returncode == 1 | ||
assert stdout == b'' | ||
assert "(connect timeout=1)".encode('utf-8') in stderr | ||
|
||
|
||
def test_parse_error(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.