def test_dump_delete(self): time_for_temp = (time.time() - DUMPED_APPS_WRITTEN - 1, time.time() - DUMPED_APPS_WRITTEN - 1) os.utime(DUMPED_APPS_PATH, time_for_temp) sum_test = len( [files for files in os.listdir(DUMPED_APPS_PATH)] ) assertEqual(sum_test, 1) mkt_gc() assertEqual(sum_test, 0)
def test_dump_delete(self): time_for_temp = (time.time() - DUMPED_APPS_WRITTEN - 1, time.time() - DUMPED_APPS_WRITTEN - 1) os.utime(DUMPED_APPS_PATH, time_for_temp) sum_test = len([files for files in os.listdir(DUMPED_APPS_PATH)]) assertEqual(sum_test, 1) mkt_gc() assertEqual(sum_test, 0)
def test_garbage_collection(self): eq_(ActivityLog.objects.all().count(), 1) mkt_gc() eq_(ActivityLog.objects.all().count(), 0)
def test_new_no_delete(self, rm_mock, ls_mock, stat_mock): ls_mock.return_value = ['lol'] stat_mock.return_value = StatMock(days_ago=1) mkt_gc() assert not rm_mock.called
def test_dump_delete(self, rm_mock, ls_mock, stat_mock): ls_mock.return_value = ['lol'] stat_mock.return_value = StatMock(days_ago=1000) mkt_gc() assert rm_mock.call_args_list[0][0][0].endswith('lol')
def test_garbage_collection(self, rm_mock, ls_mock, stat_mock): eq_(ActivityLog.objects.all().count(), 1) mkt_gc() eq_(ActivityLog.objects.all().count(), 0)