Exemplo n.º 1
0
 def test_defaultPath(self):
     """
     The default hosts file used by L{Resolver} is I{/etc/hosts} if no value
     is given for the C{file} initializer parameter.
     """
     resolver = Resolver()
     self.assertEqual(b"/etc/hosts", resolver.file)
Exemplo n.º 2
0
    def setUp(self):
        f = self.path()
        f.setContent(b'''
1.1.1.1    EXAMPLE EXAMPLE.EXAMPLETHING
::2        mixed
1.1.1.2    MIXED
::1        ip6thingy
1.1.1.3    multiple
1.1.1.4    multiple
::3        ip6-multiple
::4        ip6-multiple
''')
        self.ttl = 4200
        self.resolver = Resolver(f.path, self.ttl)
Exemplo n.º 3
0
    def setUp(self):
        f = open('EtcHosts', 'w')
        f.write('''
1.1.1.1    EXAMPLE EXAMPLE.EXAMPLETHING
::2        mixed
1.1.1.2    MIXED
::1        ip6thingy
1.1.1.3    multiple
1.1.1.4    multiple
::3        ip6-multiple
::4        ip6-multiple
''')
        f.close()
        self.ttl = 4200
        self.resolver = Resolver('EtcHosts', self.ttl)
Exemplo n.º 4
0
    def setUp(self):
        f = self.path()
        f.setContent(b"""
1.1.1.1    EXAMPLE EXAMPLE.EXAMPLETHING
::2        mixed
1.1.1.2    MIXED
::1        ip6thingy
1.1.1.3    multiple
1.1.1.4    multiple
::3        ip6-multiple
::4        ip6-multiple
not-an-ip  malformed
malformed
# malformed
1.1.1.5    malformed
::5        malformed
""")
        self.ttl = 4200
        self.resolver = Resolver(f.path, self.ttl)