~cloud-init-dev/cloud-init/trunk

« back to all changes in this revision

Viewing changes to tests/unittests/test_distros/test_hosts.py

Enable flake8 and fix a large amount of reported issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
class TestHostsHelper(unittest.TestCase):
18
18
    def test_parse(self):
19
19
        eh = hosts.HostsConf(BASE_ETC)
20
 
        self.assertEquals(eh.get_entry('127.0.0.1'), [['localhost']])
21
 
        self.assertEquals(eh.get_entry('192.168.1.10'),
22
 
                          [['foo.mydomain.org', 'foo'],
23
 
                           ['bar.mydomain.org', 'bar']])
 
20
        self.assertEqual(eh.get_entry('127.0.0.1'), [['localhost']])
 
21
        self.assertEqual(eh.get_entry('192.168.1.10'),
 
22
                         [['foo.mydomain.org', 'foo'],
 
23
                          ['bar.mydomain.org', 'bar']])
24
24
        eh = str(eh)
25
25
        self.assertTrue(eh.startswith('# Example'))
26
26
 
27
27
    def test_add(self):
28
28
        eh = hosts.HostsConf(BASE_ETC)
29
29
        eh.add_entry('127.0.0.0', 'blah')
30
 
        self.assertEquals(eh.get_entry('127.0.0.0'), [['blah']])
 
30
        self.assertEqual(eh.get_entry('127.0.0.0'), [['blah']])
31
31
        eh.add_entry('127.0.0.3', 'blah', 'blah2', 'blah3')
32
 
        self.assertEquals(eh.get_entry('127.0.0.3'),
33
 
                          [['blah', 'blah2', 'blah3']])
 
32
        self.assertEqual(eh.get_entry('127.0.0.3'),
 
33
                         [['blah', 'blah2', 'blah3']])
34
34
 
35
35
    def test_del(self):
36
36
        eh = hosts.HostsConf(BASE_ETC)
37
37
        eh.add_entry('127.0.0.0', 'blah')
38
 
        self.assertEquals(eh.get_entry('127.0.0.0'), [['blah']])
 
38
        self.assertEqual(eh.get_entry('127.0.0.0'), [['blah']])
39
39
 
40
40
        eh.del_entries('127.0.0.0')
41
 
        self.assertEquals(eh.get_entry('127.0.0.0'), [])
 
41
        self.assertEqual(eh.get_entry('127.0.0.0'), [])