def test_apply_config_writes_template_to_etc_hosts(self):
        hostname.apply_config(self.fixture)

        self.mock_filltemplate.assert_called_once_with("/etc/hypernode/templates/03.hostname.hosts",
                                                       {'hostnames': self.fixture['hostnames'],
                                                        'app_name': self.fixture['app_name']})

        self.mock_writefile.assert_any_call("/etc/hosts", self.mock_template_contents)
 def test_apply_config_restarts_syslog(self):
     hostname.apply_config(self.fixture)
     self.mock_call.assert_any_call(["service", "rsyslog", "restart"])
 def test_apply_config_calls_hostname_to_set_hostname(self):
     hostname.apply_config(self.fixture)
     self.mock_call.assert_any_call(["hostname", self.fixture["app_name"]])
 def test_apply_config_writes_appname_to_etc_hostname(self):
     hostname.apply_config(self.fixture)
     self.mock_writefile.assert_any_call("/etc/hostname", self.fixture["app_name"])
 def test_apply_config_checks_hostnames_and_appname_vars(self):
     hostname.apply_config(self.fixture)
     self.mock_checkvars.assert_called_once_with(self.fixture, ["hostnames", "app_name"])