'Confirm that command-line option parsing produces the same results as using call_command() directly,
mostly as a sanity check for the logic in rebuild_index which combines the option_lists for its
component commands.'

@patch(u'haystack.management.commands.update_index.Command.handle')
@patch(u'haystack.management.commands.clear_index.Command.handle')
def test_rebuild_index_nocommit(self, *mocks):

    from haystack.management.commands.rebuild_index import Command
    Command().run_from_argv([u'django-admin.py', u'rebuild_index', u'--noinput', u'--nocommit'])
    for m in mocks:
        self.assertEqual(m.call_count, 1)
        (args, kwargs) = m.call_args
        self.assertIn(u'commit', kwargs)
        self.assertEqual(False, kwargs[u'commit'])
        self.assertIn(u'interactive', kwargs)
        self.assertEqual(False, kwargs[u'interactive'])
