Ejemplo n.º 1
0
 def test_get_alias_none(self):
     '''
     Tests return the list of aliases associated with an ip
     '''
     with patch('salt.modules.hosts._list_hosts',
                MagicMock(return_value={'10.10.10.10': ['Salt1', 'Salt2']})):
         self.assertListEqual([], hosts.get_alias('10.10.10.11'))
Ejemplo n.º 2
0
 def test_get_alias_none(self):
     """
     Tests return the list of aliases associated with an ip
     """
     with patch(
             "salt.modules.hosts._list_hosts",
             MagicMock(return_value={"10.10.10.10": ["Salt1", "Salt2"]}),
     ):
         self.assertListEqual([], hosts.get_alias("10.10.10.11"))
Ejemplo n.º 3
0
 def test_get_alias_none(self):
     '''
     Tests return the list of aliases associated with an ip
     '''
     self.assertListEqual([], hosts.get_alias('10.10.10.11'))
Ejemplo n.º 4
0
 def test_get_alias(self):
     '''
     Tests return the list of aliases associated with an ip
     '''
     self.assertListEqual(['Salt1', 'Salt2'],
                          hosts.get_alias('10.10.10.10'))
Ejemplo n.º 5
0
 def test_get_alias_none(self):
     '''
     Tests return the list of aliases associated with an ip
     '''
     self.assertListEqual([], hosts.get_alias('10.10.10.11'))
Ejemplo n.º 6
0
 def test_get_alias(self):
     '''
     Tests return the list of aliases associated with an ip
     '''
     self.assertListEqual(['Salt1', 'Salt2'], hosts.get_alias('10.10.10.10'))
Ejemplo n.º 7
0
 def test_get_alias(self):
     list_hosts.hosts_filename = self.hostspath
     self.assertEqual(get_alias('127.0.0.1'), ['localhost', 'myname'])
     self.assertEqual(get_alias('127.0.0.2'), [])
     list_hosts.hosts_filename = self.not_found
     self.assertEqual(get_alias('127.0.0.1'), [])
Ejemplo n.º 8
0
 def test_get_alias(self):
     list_hosts.hosts_filename = self.hostspath
     self.assertEqual(get_alias('127.0.0.1'), ['localhost', 'myname'])
     self.assertEqual(get_alias('127.0.0.2'), [])
     list_hosts.hosts_filename = self.not_found
     self.assertEqual(get_alias('127.0.0.1'), [])
Ejemplo n.º 9
0
 def test_get_alias_none(self):
     """
     Tests return the list of aliases associated with an ip
     """
     self.assertListEqual([], hosts.get_alias("10.10.10.11"))
Ejemplo n.º 10
0
 def test_get_alias(self):
     """
     Tests return the list of aliases associated with an ip
     """
     self.assertListEqual(["Salt1", "Salt2"], hosts.get_alias("10.10.10.10"))