Exemplo n.º 1
0
    def test_get_ip(self):
        '''
        Tests return ip associated with the named host
        '''
        self.assertEqual('10.10.10.10', hosts.get_ip('Salt1'))

        self.assertEqual('', hosts.get_ip('Salt3'))
Exemplo n.º 2
0
    def test_get_ip(self):
        '''
        Tests return ip associated with the named host
        '''
        self.assertEqual('10.10.10.10', hosts.get_ip('Salt1'))

        self.assertEqual('', hosts.get_ip('Salt3'))
Exemplo n.º 3
0
    def test_get_ip(self):
        """
        Tests return ip associated with the named host
        """
        self.assertEqual("10.10.10.10", hosts.get_ip("Salt1"))

        self.assertEqual("", hosts.get_ip("Salt3"))
Exemplo n.º 4
0
    def test_get_ip(self):
        '''
        Tests return ip associated with the named host
        '''
        with patch('salt.modules.hosts._list_hosts',
                   MagicMock(return_value={'10.10.10.10': ['Salt1', 'Salt2']})):
            self.assertEqual('10.10.10.10', hosts.get_ip('Salt1'))

            self.assertEqual('', hosts.get_ip('Salt3'))
Exemplo n.º 5
0
    def test_get_ip(self):
        """
        Tests return ip associated with the named host
        """
        with patch(
                "salt.modules.hosts._list_hosts",
                MagicMock(return_value={"10.10.10.10": ["Salt1", "Salt2"]}),
        ):
            self.assertEqual("10.10.10.10", hosts.get_ip("Salt1"))

            self.assertEqual("", hosts.get_ip("Salt3"))
Exemplo n.º 6
0
 def test_get_ip_none(self):
     """
     Tests return ip associated with the named host
     """
     with patch("salt.modules.hosts._list_hosts",
                MagicMock(return_value="")):
         self.assertEqual("", hosts.get_ip("Salt1"))
Exemplo n.º 7
0
 def test_get_ip_none(self):
     '''
     Tests return ip associated with the named host
     '''
     with patch('salt.modules.hosts._list_hosts',
                MagicMock(return_value='')):
         self.assertEqual('', hosts.get_ip('Salt1'))
Exemplo n.º 8
0
 def test_get_ip(self):
     list_hosts.hosts_filename = self.hostspath
     self.assertEqual(get_ip('myname'), '127.0.0.1')
     self.assertEqual(get_ip('othername'), '')
     list_hosts.hosts_filename = self.not_found
     self.assertEqual(get_ip('othername'), '')
Exemplo n.º 9
0
 def test_get_ip(self):
     list_hosts.hosts_filename = self.hostspath
     self.assertEqual(get_ip('myname'), '127.0.0.1')
     self.assertEqual(get_ip('othername'), '')
     list_hosts.hosts_filename = self.not_found
     self.assertEqual(get_ip('othername'), '')