Exemple #1
0
    def test_01_facter(self):

        f = Facter()
        facts = f.facts()

        self.assertTrue(isinstance(facts, dict))
        self.assertTrue(facts.has_key('uptime'))
Exemple #2
0
    def test_01_facter(self):

        f = Facter()
        facts = f.facts()

        self.assertTrue(isinstance(facts, dict))
        self.assertTrue(facts.has_key('uptime'))
Exemple #3
0
    def test_fetch_all(self):

        f = Facter()
        facts = f.facts()

        self.assertTrue(isinstance(facts, dict))
        self.assertTrue(facts.has_key('architecture'))
        self.assertTrue(facts.has_key('ipaddress'))
        self.assertTrue(facts.has_key('fqdn'))
Exemple #4
0
    def test_fetch_all(self):

        f = Facter()
        facts = f.facts()

        self.assertTrue(isinstance(facts, dict))
        self.assertTrue(facts.has_key('architecture'))
        self.assertTrue(facts.has_key('ipaddress'))
        self.assertTrue(facts.has_key('fqdn'))
Exemple #5
0
    def test_fetch_filter(self):

        f = Facter()

        key_filter = [
            re.compile(r"arch"),
            re.compile(r"fqdn"),
            re.compile(r"ip"),
        ]
        filtered = f.facts(key_filter=key_filter)

        self.assertTrue(isinstance(filtered, dict))
        self.assertTrue(filtered.has_key('architecture'))
        self.assertTrue(filtered.has_key('ipaddress'))
        self.assertTrue(filtered.has_key('fqdn'))
Exemple #6
0
    def test_fetch_filter(self):

        f = Facter()

        key_filter = [
            re.compile(r"arch"),
            re.compile(r"fqdn"),
            re.compile(r"ip"),
        ]
        filtered = f.facts(key_filter=key_filter)

        self.assertTrue(isinstance(filtered, dict))
        self.assertTrue(filtered.has_key('architecture'))
        self.assertTrue(filtered.has_key('ipaddress'))
        self.assertTrue(filtered.has_key('fqdn'))
Exemple #7
0
    def test_cache_facter(self):

        f1 = Facter()
        f2 = Facter()
        f1facts = f1.facts()
        f2facts = f2.facts()

        self.assertEqual(f1facts['fqdn'], f2facts['fqdn'])

        self.assertTrue(Facter.__FACTER_HANDLER__)
        f1.clear()

        self.assertFalse(Facter.__FACTER_HANDLER__)
Exemple #8
0
    def test_cache_facter(self):

        f1 = Facter()
        f2 = Facter()
        f1facts = f1.facts()
        f2facts = f2.facts()

        self.assertEqual(f1facts['fqdn'], f2facts['fqdn'])

        self.assertTrue(Facter.__FACTER_HANDLER__)
        f1.clear()

        self.assertFalse(Facter.__FACTER_HANDLER__)
Exemple #9
0
    def test_00_no_facter(self):

        f = Facter(facter="/no/such/file/facter")
        self.assertEqual(f.facts(), {})
Exemple #10
0
    def test_00_no_facter(self):

        f = Facter(facter="/no/such/file/facter")
        self.assertEqual(f.facts(), {})