diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-04-12 13:06:49 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-04-12 13:06:49 -0400 |
commit | 03c81fdcf924da8b87fd690761d4ce2fbd47854e (patch) | |
tree | 88f22f94e2ea940eb120f70d47ee5d579ce5f01c /tests/unittests | |
parent | 5cfe3d6fa2d50a68f9b6c7ceb4b9d5db09687782 (diff) | |
parent | 578fed15061293ce421eec1c9c1e2e056631a734 (diff) | |
download | vyos-cloud-init-03c81fdcf924da8b87fd690761d4ce2fbd47854e.tar.gz vyos-cloud-init-03c81fdcf924da8b87fd690761d4ce2fbd47854e.zip |
rh_subscription: only check subscription if configured
The rh_subscription config module would attempt to connect to the RHN servers
even when no config is provided.
Now, instead check to make sure that valid config is provided first.
That consists of username and password or a activation key.
LP: #1536706
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_rh_subscription.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/unittests/test_rh_subscription.py b/tests/unittests/test_rh_subscription.py index 38d5763a..8c586ad7 100644 --- a/tests/unittests/test_rh_subscription.py +++ b/tests/unittests/test_rh_subscription.py @@ -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.input_is_missing_data(self.config_no_password) + self.SM._sub_man_cli = mock.MagicMock( + side_effect=[util.ProcessExecutionError, (self.reg, 'bar')]) + self.handle(self.name, 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): ''' |