def test_subman_profile_enabled_missing_config_key(self, mock_init): mock_config = Mock() mock_init.return_value = mock_config mock_config.get.side_effect = NoOptionError('rhsm', 'package_profile_on_trans') self.assertTrue(utils.plugin_enabled(ENABLED_CONF)) mock_config.get.assert_called_with('rhsm', 'package_profile_on_trans')
def test_subman_profile_enabled_disabled(self, mock_init): mock_config = Mock() mock_init.return_value = mock_config mock_config.get.return_value = '0' self.assertTrue(utils.plugin_enabled(ENABLED_CONF)) mock_config.get.assert_called_with('rhsm', 'package_profile_on_trans')
def upload_package_profile(force=False): if not plugin_enabled(PACKAGE_PROFILE_PLUGIN_CONF, DISABLE_PACKAGE_PROFILE_VAR, force): return consumer_id = lookup_consumer_id() if consumer_id is None: sys.stderr.write("Cannot upload package profile. Is this client registered?\n") else: get_manager().profilelib._do_update()
def upload_package_profile(force=False): if not plugin_enabled(PACKAGE_PROFILE_PLUGIN_CONF, DISABLE_PACKAGE_PROFILE_VAR, force): return consumer_id = lookup_consumer_id() if consumer_id is None: sys.stderr.write( "Cannot upload package profile. Is this client registered?\n") else: get_manager().profilelib._do_update()
def upload_enabled_repos_report(report, force=False): if not plugin_enabled(ENABLED_REPOS_PLUGIN_CONF, DISABLE_ENABLE_REPOS_VAR, force): return content = report.content consumer_id = lookup_consumer_id() if consumer_id is None: error_message( 'Cannot upload enabled repos report, is this client registered?') else: cache = EnabledRepoCache(consumer_id, content) if not cache.is_valid() and report_enabled_repos(consumer_id, content): cache.save()
def test_env_disabled_force(self, mock_subman): os.environ['testa'] = 'true' self.assertTrue(utils.plugin_enabled(ENABLED_CONF, 'testa', True))
def test_env_disabled(self, mock_subman): os.environ['testa'] = 'true' self.assertFalse(utils.plugin_enabled(ENABLED_CONF, 'testa'))
def test_conf_disabled_force(self, mock_subman): self.assertTrue(utils.plugin_enabled(DISABLED_CONF, None, True))
def test_conf_disabled(self, mock_subman): self.assertFalse(utils.plugin_enabled(DISABLED_CONF))
def test_conf_enabled(self, mock_subman): self.assertTrue(utils.plugin_enabled(ENABLED_CONF))