Example #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'))
Example #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"))
Example #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'))
Example #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'))
Example #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'))
Example #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'))
Example #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'), [])
Example #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'), [])
Example #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"))
Example #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"))