~harlowja/cloud-init/cloud-init-net-refactor

« back to all changes in this revision

Viewing changes to tests/unittests/test_handler/test_handler_set_hostname.py

Enable flake8 and fix a large amount of reported issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
from .. import helpers as t_help
9
9
 
 
10
from configobj import ConfigObj
 
11
import logging
10
12
import shutil
 
13
from six import BytesIO
11
14
import tempfile
12
 
import logging
13
 
 
14
 
from six import BytesIO
15
 
 
16
 
from configobj import ConfigObj
17
15
 
18
16
LOG = logging.getLogger(__name__)
19
17
 
43
41
        if not distro.uses_systemd():
44
42
            contents = util.load_file("/etc/sysconfig/network", decode=False)
45
43
            n_cfg = ConfigObj(BytesIO(contents))
46
 
            self.assertEquals({'HOSTNAME': 'blah.blah.blah.yahoo.com'},
47
 
                              dict(n_cfg))
 
44
            self.assertEqual({'HOSTNAME': 'blah.blah.blah.yahoo.com'},
 
45
                             dict(n_cfg))
48
46
 
49
47
    def test_write_hostname_debian(self):
50
48
        cfg = {
58
56
        cc_set_hostname.handle('cc_set_hostname',
59
57
                               cfg, cc, LOG, [])
60
58
        contents = util.load_file("/etc/hostname")
61
 
        self.assertEquals('blah', contents.strip())
 
59
        self.assertEqual('blah', contents.strip())
62
60
 
63
61
    def test_write_hostname_sles(self):
64
62
        cfg = {
71
69
        self.patchUtils(self.tmp)
72
70
        cc_set_hostname.handle('cc_set_hostname', cfg, cc, LOG, [])
73
71
        contents = util.load_file("/etc/HOSTNAME")
74
 
        self.assertEquals('blah', contents.strip())
 
72
        self.assertEqual('blah', contents.strip())