def test_no_trust_agent(self): framework = object() registry.initialize(framework) registry.trust_agent = False f = IPATrustAgentCheck(registry) f.config = config.Config() self.results = capture_results(f) # Zero because the call was skipped altogether assert len(self.results) == 0
def test_trust_agent_ok(self, mock_sssd): mock_sssd.return_value = SSSDConfig(return_domains=True, return_ipa_server_mode=True) framework = object() registry.initialize(framework) registry.trust_agent = True f = IPATrustAgentCheck(registry) f.config = config.Config() self.results = capture_results(f) assert len(self.results) == 1 result = self.results.results[0] assert result.result == constants.SUCCESS assert result.source == 'ipahealthcheck.ipa.trust' assert result.check == 'IPATrustAgentCheck'
def test_trust_agent_fail(self, mock_sssd): mock_sssd.return_value = SSSDConfig(return_domains=True, return_ipa_server_mode=None) framework = object() registry.initialize(framework) registry.trust_agent = True f = IPATrustAgentCheck(registry) f.config = config.Config() self.results = capture_results(f) assert len(self.results) == 1 result = self.results.results[0] assert result.result == constants.ERROR assert result.source == 'ipahealthcheck.ipa.trust' assert result.check == 'IPATrustAgentCheck' assert result.kw.get('key') == 'ipa_server_mode_missing' assert result.kw.get('domain') == 'ipa.example'