Esempio n. 1
0
 def test_get_id_etc_hosts(self):
     '''
     Test calling salt.config.get_id() and falling back all the way to
     looking up data from /etc/hosts.
     '''
     with patch('salt.utils.fopen', _fopen_side_effect_etc_hosts):
         self.assertEqual(sconfig.get_id(cache=False),
                          (MOCK_HOSTNAME, False))
Esempio n. 2
0
 def test_get_id_etc_hostname(self):
     '''
     Test calling salt.config.get_id() and falling back to looking at
     /etc/hostname.
     '''
     with patch('salt.utils.fopen', _fopen_side_effect_etc_hostname):
         self.assertEqual(sconfig.get_id(cache=False),
                          (MOCK_HOSTNAME, False))
Esempio n. 3
0
 def test_get_id_etc_hosts(self):
     '''
     Test calling salt.config.get_id() and falling back all the way to
     looking up data from /etc/hosts.
     '''
     with patch('salt.utils.fopen', _fopen_side_effect_etc_hosts):
         self.assertEqual(
             sconfig.get_id(cache=False), ('foo.bar.net', False)
         )
Esempio n. 4
0
 def test_get_id_etc_hostname(self):
     '''
     Test calling salt.config.get_id() and falling back to looking at
     /etc/hostname.
     '''
     with patch('salt.utils.fopen', _fopen_side_effect_etc_hostname):
         self.assertEqual(
             sconfig.get_id(cache=False), ('foo.bar.com', False)
         )
Esempio n. 5
0
 def test_get_id_etc_hosts(self):
     '''
     Test calling salt.config.get_id() and falling back all the way to
     looking up data from /etc/hosts.
     '''
     with patch('salt.utils.fopen', _fopen_side_effect_etc_hosts):
         self.assertEqual(
                 sconfig.get_id({'root_dir': None, 'minion_id_caching': False}), (MOCK_HOSTNAME, False)
         )
Esempio n. 6
0
 def test_get_id_socket_getfqdn(self):
     '''
     Test calling salt.config.get_id() and getting the hostname from
     socket.getfqdn()
     '''
     with patch('salt.utils.fopen',
                MagicMock(side_effect=_unhandled_mock_read)):
         self.assertEqual(sconfig.get_id(cache=False),
                          ('foo.bar.org', False))
Esempio n. 7
0
 def test_get_id_socket_get_fqhostname(self):
     '''
     Test calling salt.config.get_id() and getting the hostname from
     salt.utils.network.get_fqhostname()
     '''
     with patch('salt.utils.fopen',
                MagicMock(side_effect=_unhandled_mock_read)):
         self.assertEqual(
             sconfig.get_id(cache=False), ('foo.bar.org', False)
         )