Ejemplo n.º 1
0
 def test_repo_ca_cert_macro(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG_MACRO)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEquals('/etc/rhsm-host/ca/',
         config.get('rhsm', 'ca_cert_dir'))
     self.assertEquals('/etc/rhsm-host/ca/redhat-uep.pem',
         config.get('rhsm', 'repo_ca_cert'))
Ejemplo n.º 2
0
 def test_repo_ca_cert_macro(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG_MACRO)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEqual('/etc/rhsm-host/ca/',
                      config.get('rhsm', 'ca_cert_dir'))
     self.assertEqual('/etc/rhsm-host/ca/redhat-uep.pem',
                      config.get('rhsm', 'repo_ca_cert'))
Ejemplo n.º 3
0
 def test_no_replacements(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG_NOREPLACE)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEquals('/etc/rhsm-other/ca',
         config.get('rhsm', 'ca_cert_dir'))
     self.assertEquals('/etc/pki/ca/redhat-uep.pem',
         config.get('rhsm', 'repo_ca_cert'))
     self.assertEquals('/etc/pki/entitlement-other',
         config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 4
0
 def test_normal_case(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEquals('/etc/rhsm-host/ca',
         config.get('rhsm', 'ca_cert_dir'))
     self.assertEquals('/etc/rhsm-host/redhat-uep-non-default.pem',
         config.get('rhsm', 'repo_ca_cert'))
     self.assertEquals('/etc/pki/entitlement-host',
         config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 5
0
 def test_no_replacements(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG_NOREPLACE)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEqual('/etc/rhsm-other/ca',
                      config.get('rhsm', 'ca_cert_dir'))
     self.assertEqual('/etc/pki/ca/redhat-uep.pem',
                      config.get('rhsm', 'repo_ca_cert'))
     self.assertEqual('/etc/pki/entitlement-other',
                      config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 6
0
 def test_normal_case(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEqual('/etc/rhsm-host/ca',
                      config.get('rhsm', 'ca_cert_dir'))
     self.assertEqual('/etc/rhsm-host/redhat-uep-non-default.pem',
                      config.get('rhsm', 'repo_ca_cert'))
     self.assertEqual('/etc/pki/entitlement-host',
                      config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 7
0
 def test_host_config_regular_entcertdir(self, exists_mock):
     # Mock that /etc/pki/entitlement-host does not exist,
     # our setting should be left alone.
     exists_mock.return_value = False
     temp_file = write_temp_file(HOST_CONFIG)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEquals('/etc/rhsm-host/ca',
         config.get('rhsm', 'ca_cert_dir'))
     self.assertEquals('/etc/rhsm-host/redhat-uep-non-default.pem',
         config.get('rhsm', 'repo_ca_cert'))
     self.assertEquals('/etc/pki/entitlement',
         config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 8
0
 def test_host_config_regular_entcertdir(self, exists_mock):
     # Mock that /etc/pki/entitlement-host does not exist,
     # our setting should be left alone.
     exists_mock.return_value = False
     temp_file = write_temp_file(HOST_CONFIG)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEqual('/etc/rhsm-host/ca',
                      config.get('rhsm', 'ca_cert_dir'))
     self.assertEqual('/etc/rhsm-host/redhat-uep-non-default.pem',
                      config.get('rhsm', 'repo_ca_cert'))
     self.assertEqual('/etc/pki/entitlement',
                      config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 9
0
 def test_ent_dir_trailing_slash(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG_ENTDIR_TRAILING_SLASH)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEquals('/etc/pki/entitlement-host',
         config.get('rhsm', 'entitlementCertDir'))
Ejemplo n.º 10
0
 def test_ent_dir_trailing_slash(self, exists_mock):
     # Mock that /etc/pki/entitlement-host exists:
     exists_mock.return_value = True
     temp_file = write_temp_file(HOST_CONFIG_ENTDIR_TRAILING_SLASH)
     config = RhsmHostConfigParser(temp_file.name)
     self.assertEqual('/etc/pki/entitlement-host',
                      config.get('rhsm', 'entitlementCertDir'))