Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
[#30] - Cover last line over ambari config param
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacBlanco committed Aug 15, 2016
1 parent 9ddf99f commit d9d13c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demo_utils/demo_utils/ambari.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def set_port(self, port):
self.client.set_port(self.port)

def set_service_wait_time(self, wait_time):
'''Set the timeout (in seconds) when waiting for a service to change states
'''Set the timeout (in seconds) when waiting for a service to change states. i.e to Start/Stop/Restart a service.
Args:
wait_time (int)
Expand Down
14 changes: 8 additions & 6 deletions demo_utils/tests/test_ambari.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ def test_ambari_config_object(self):
'password': 'test_password',
'proto': 'https',
'server': 'sandbox_server',
'port': 12309
'port': 12309,
'service_wait_time': 45
}

amc = Ambari(config=conf)
Expand All @@ -308,17 +309,18 @@ def test_ambari_config_object(self):
assert amc.proto == conf['proto'], 'protocols must match'
assert amc.server == conf['server'], 'servers must match'
assert amc.port == conf['port'], 'ports must match'
assert amc.service_wait_time == conf['service_wait_time'], 'wait_times must match'

amc = Ambari(config='Config String should throw log warning')

@mock.patch('demo_utils.shell.Shell.run', return_value=['', 'curl (6) could not connect to host'])
def test_bad_config_ambari_service(self, mock1):
conf = {
'username': 'test_username',
'password': 'test_password',
'proto': 'https',
'server': 'sandbox_server',
'port': 12309
'b': 'test_username',
'a': 'test_password',
'c': 'https',
'd': 'sandbox_server',
'e': 12309
}

amc = Ambari(config=conf)
Expand Down
2 changes: 1 addition & 1 deletion demo_utils/tests/test_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_bad(self, mock1):
assert handler.level == 30


@mock.patch('demo_utils.config.read_config', return_value={'LOGGING': {'bad-level': 'MISSING', 'log-file': 'tmp-log.log'}})
@mock.patch('demo_utils.config.read_config', return_value={'LOGGING': {'bad-level': 'MISSING', 'log-file': './cover/tmp-log.log'}})
def test_log_file(self, mock1):
logger = Logger('test_file').getLogger()
assert len(logger.handlers) == 2, 'Should have two log handlers'
Expand Down

0 comments on commit d9d13c5

Please sign in to comment.