'Tests whether a course should be dumped given the last time it was
dumped and the last time it was published.'

@mock.patch(u'openedx.core.djangoapps.coursegraph.tasks.get_course_last_published')
@mock.patch(u'openedx.core.djangoapps.coursegraph.tasks.get_command_last_run')
@ddt.data((six.text_type(datetime(2016, 3, 30)), six.text_type(datetime(2016, 3, 31)), True), (six.text_type(datetime(2016, 3, 31)), six.text_type(datetime(2016, 3, 30)), False), (six.text_type(datetime(2016, 3, 31)), None, False), (None, six.text_type(datetime(2016, 3, 30)), True), (None, None, True))
@ddt.unpack
def test_should_dump_course(self, last_command_run, last_course_published, should_dump, mock_get_command_last_run, mock_get_course_last_published):

    mock_get_command_last_run.return_value = last_command_run
    mock_get_course_last_published.return_value = last_course_published
    mock_course_key = mock.Mock
    mock_graph = mock.Mock()
    self.assertEqual(should_dump_course(mock_course_key, mock_graph), should_dump)
