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'))
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"))
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'))
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"))
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"))
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'))
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'), '')