def test_join_corosync_unicast(self):
        '''
        Test _join_corosync_unicast
        '''
        mock_cmd_retcode = MagicMock(return_value=0)
        mock_cmd_run = MagicMock()
        mock_get_hostname = MagicMock(return_value='node')
        mock_interface_ip = MagicMock(return_value='1.0.1.0')

        with patch.dict(
                crmshmod.__salt__, {
                    'cmd.retcode': mock_cmd_retcode,
                    'cmd.run': mock_cmd_run,
                    'network.get_hostname': mock_get_hostname,
                    'network.interface_ip': mock_interface_ip
                }):
            crmshmod._join_corosync_unicast('main_node', 'eth1')
            mock_cmd_retcode.assert_called_once_with(
                'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -t '
                'root@{host} "grep \'transport: udpu\' {conf}"'.format(
                    host='main_node', conf='/etc/corosync/corosync.conf'))
            mock_interface_ip.assert_called_once_with('eth1')
            mock_cmd_run.assert_called_once_with(
                'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -t '
                'root@{host} "sudo {crm_command} corosync add-node {addr} {name}"'
                .format(host='main_node',
                        crm_command=crmshmod.CRM_COMMAND,
                        addr='1.0.1.0',
                        name='node'),
                raise_err=True)
    def test_join_corosync_not_unicast(self, logger):
        '''
        Test _join_corosync_unicast
        '''
        mock_cmd_retcode = MagicMock(return_value=1)

        with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_retcode}):
            crmshmod._join_corosync_unicast('main_node', 'eth1')
            mock_cmd_retcode.assert_called_once_with((
                'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -t '
                'root@{host} "grep \'transport: udpu\' {conf}"'.format(
                    host='main_node', conf='/etc/corosync/corosync.conf')))
            logger.assert_called_once_with('cluster not set as unicast')