def test_no_overwrite(self):
     # kwargs = {'overwrite': False}
     kwargs = {}
     task = ImportStudentCourseEnrollmentTask(**kwargs)
     with patch('edx.analytics.tasks.database_imports.HivePartitionTarget') as mock_target:
         output = mock_target()
         # Make MagicMock act more like a regular mock, so that flatten() does the right thing.
         del output.__iter__
         del output.__getitem__
         output.exists = Mock(return_value=False)
         self.assertFalse(task.complete())
         self.assertTrue(output.exists.called)
         output.exists = Mock(return_value=True)
         self.assertTrue(task.complete())
         self.assertTrue(output.exists.called)
예제 #2
0
 def test_no_overwrite(self):
     # kwargs = {'overwrite': False}
     kwargs = {}
     task = ImportStudentCourseEnrollmentTask(**kwargs)
     with patch('edx.analytics.tasks.database_imports.HivePartitionTarget'
                ) as mock_target:
         output = mock_target()
         # Make MagicMock act more like a regular mock, so that flatten() does the right thing.
         del output.__iter__
         del output.__getitem__
         output.exists = Mock(return_value=False)
         self.assertFalse(task.complete())
         self.assertTrue(output.exists.called)
         output.exists = Mock(return_value=True)
         self.assertTrue(task.complete())
         self.assertTrue(output.exists.called)
예제 #3
0
 def test_overwrite(self):
     kwargs = {'overwrite': True}
     task = ImportStudentCourseEnrollmentTask(**kwargs)
     self.assertFalse(task.complete())
 def test_overwrite(self):
     kwargs = {'overwrite': True}
     task = ImportStudentCourseEnrollmentTask(**kwargs)
     self.assertFalse(task.complete())