Commit 578fed15 authored by Scott Moser's avatar Scott Moser

fix tests and hopefully actually work

parent eb5a4dda
......@@ -23,11 +23,10 @@ def handle(name, cfg, _cloud, log, _args):
sm = SubscriptionManager(cfg)
sm.log = log
if not sm.is_configured():
log.debug("Activation key not provided, config module %s disabled.",
log.debug("%s: module not configured.", name)
return None
if not sm.is_registered:
if not sm.is_registered():
verify, verify_msg = sm._verify_keys()
if verify is not True:
......@@ -406,4 +405,4 @@ class SubscriptionManager(object):
return True
def is_configured(self):
return (self.userid and self.password) or self.activation_key
return bool((self.userid and self.password) or self.activation_key)
......@@ -126,7 +126,8 @@ class TestBadInput(unittest.TestCase):
'enable-repo': 'not_a_list'
config_badkey = {'rh_subscription':
{'activation_key': 'abcdef1234',
{'activation-key': 'abcdef1234',
'fookey': 'bar',
'org': '123',
......@@ -138,7 +139,11 @@ class TestBadInput(unittest.TestCase):
Attempt to register without the password key/value
self.SM._sub_man_cli = mock.MagicMock(
side_effect=[util.ProcessExecutionError, (self.reg, 'bar')])
self.handle(, self.config_no_password, self.cloud_init,
self.log, self.args)
self.assertEqual(self.SM._sub_man_cli.call_count, 0)
def test_no_org(self):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment